home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / cplus / 18785 < prev    next >
Encoding:
Text File  |  1993-01-06  |  1.6 KB  |  48 lines

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