Subject: 16 bytes not freed on close
From: [email-masked] (Steve Kachman)

24 Jun 1997 10:15:40 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Sender: [email-masked]
X-Mailer: Windows Eudora Light Version 3.0.1 (32)
Original-To: [email-masked]
Original-Sender: [email-masked]

Sorry about the 32K message. I have included a small program to illustrate
the problem. 

#include <fstream.h>
extern "C" {
  extern unsigned _stklen;
  int _mstats(char * s);
}

main(int argc,char **argv)
{
  _mstats("Before open");
  {
    cerr << argv[1]  ;
    #ifdef WITH_OPEN
    fstream file(argv[1],ios::out);
  _mstats("Before close");
    file.close();
  _mstats("After close");
  file.open(argv[1],ios::out);
  _mstats("Before close");
    file.close();
  _mstats("After close");
  file.open(argv[1],ios::out);
  _mstats("Before close");
    file.close();
  _mstats("After close");
    #endif
    cerr << " is open\n";
  }
  _mstats("After close");
}

The resulting output:

Memory allocation statistics Before open
free:	 0 255 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
used:	 0 1 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
	Total in use: 4240, total free: 8048
emptyMemory allocation statistics Before close
free:	 0 254 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
used:	 0 2 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
	Total in use: 4256, total free: 8032
Memory allocation statistics After close
free:	 0 254 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
used:	 0 2 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
	Total in use: 4256, total free: 8032
Memory allocation statistics Before close
free:	 0 253 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
used:	 0 3 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
	Total in use: 4272, total free: 8016
Memory allocation statistics After close
free:	 0 253 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
used:	 0 3 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
	Total in use: 4272, total free: 8016
Memory allocation statistics Before close
free:	 0 252 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
used:	 0 4 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
	Total in use: 4288, total free: 8000
Memory allocation statistics After close
free:	 0 252 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
used:	 0 4 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
	Total in use: 4288, total free: 8000
 is open
Memory allocation statistics After close
free:	 0 252 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
used:	 0 4 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
	Total in use: 4288, total free: 8000

Normally I wouldn't be overly concerned except the program I am working on
performs approx. 7 million open and close operations. 

Steve Kachman
[email-masked]

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".