From: skachman@unl.edu (Steve Kachman)
Subject: 16 bytes not freed on close
24 Jun 1997 10:15:40 -0700
Approved: cygnus.gnu-win32@cygnus.com
Distribution: cygnus
Message-ID: <3.0.1.32.19970624114507.0080a7c0.cygnus.gnu-win32@unlinfo.unl.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Sender: skachman@unlinfo.unl.edu
X-Mailer: Windows Eudora Light Version 3.0.1 (32)
Original-To: gnu-win32@cygnus.com
Original-Sender: owner-gnu-win32@cygnus.com

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
skachman@unl.edu

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
