home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16352 < prev    next >
Encoding:
Internet Message Format  |  1992-11-16  |  907 b 

  1. Path: sparky!uunet!gatech!prism!federation!andy
  2. From: andy@federation.gatech.edu (Andy Register)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Using delete with arrays - help please!
  5. Message-ID: <74955@hydra.gatech.EDU>
  6. Date: 16 Nov 92 14:29:14 GMT
  7. References: <1992Nov16.023852.24205@gopher.dosli.govt.nz>
  8. Sender: news@prism.gatech.EDU
  9. Organization: CERL-EE, Georgia Institue of Technology
  10. Lines: 20
  11.  
  12. When I experiment with this kind of thing, I use
  13. the function
  14.  
  15. unsigned long coreleft()
  16.  
  17. from the alloc.h file.
  18.  
  19. I can call coreleft, new, delete, coreleft and if the
  20. results of the two coreleft calls are not the same
  21. then somewhere memory did not get free'd up.  Admittidly
  22. not very sophisticated but it seems to work for me.
  23.  
  24. Try it with the char * example you cited and see what happens.
  25. Also try it with you example and you will see why the [] is
  26. required in the delete.
  27.  
  28. Any other strategies?
  29.  
  30. Toodles
  31. Andy
  32.