home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!tijc02!kcc056
- From: kcc056@tijc02.uucp (Karen Bench)
- Subject: Re: TResourceFile Memory Los
- Message-ID: <1993Jan7.043523.26760@tijc02.uucp>
- Organization: Siemens Industrial Automation, Johnson City TN
- References: <726147569.0@ttlg.ttlg.UUCP>
- Date: Thu, 7 Jan 93 04:35:23 GMT
- Lines: 37
-
- From article <726147569.0@ttlg.ttlg.UUCP>, by Neal.Sanche@ttlg.UUCP (Neal Sanche):
- > Hi All,
- >
- > I am using Borland C++ 3.1 and Turbo Vision and am having a
- > memory loss of 32 bytes every time I instantiate a TResourceFile
- > and then destroy it. I have looked through the documentation and
- > my usage of this object is correct. Here is the Code:
- >
- > ...
- > fpstream *ifps;
- >
- > ifps = new fpstream("FILE.NAM", ios::out | ios::binary);
- > if (ifps->good())
- > {
- > TResourceFile *res;
- > res = new TResourceFile(ifps);
- > destroy(res);
- > }
- > else delete(ifps);
- > ...
- >
- > This code creates a TResourceFile and destroys it immediately. There
- > should be no loss of memory, but 32 bytes escape... Where is this
- > memory loss occuring? I am afraid that some kind of dangling pointer
- > will come back to haunt me and my clients! :)
- >
- > Thanks for any help you can give me.
- >
- > -Neal
- >
- > ... OFFLINE 1.41
- >
- > * Origin: Paradigm BBS: A programmer's paradise. (42:100/11)
- I had the same problem and (I think) traced it to the constructor
- in tresfile.cpp (line 50 in my source file) the variable header
- is being created but not freed so I put a delete header at the bottom
- of the constructor and this seems to fix it.
-