home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / question / 14853 < prev    next >
Encoding:
Text File  |  1992-12-21  |  1.6 KB  |  46 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!ieunet!tcdcs!unix2.tcd.ie!gburke
  3. From: gburke@unix2.tcd.ie (Garrett Burke)
  4. Subject: "FREE & Calloc & realloc"
  5. Message-ID: <gburke.724953776@unix2.tcd.ie>
  6. Summary: Does free 'really' work with realloc & calloc.
  7. Keywords: Free, memory
  8. Sender: usenet@cs.tcd.ie (NN required at ashe.cs.tcd.ie)
  9. Nntp-Posting-Host: unix2.tcd.ie
  10. Organization: Trinity College, Dublin
  11. Date: Mon, 21 Dec 1992 16:02:56 GMT
  12. Lines: 32
  13.  
  14. Hi all,
  15.     I have a program that's suffering from a memory leak (circ 12MB
  16. leaking!).  I am allocating memory with calloc for some structures and with
  17. malloc for others, and then calling realloc on those pointers.
  18.  
  19. Here's the query:
  20.  
  21. 1. Does FREE free memory allocated with realloc & calloc?
  22. 2. Could you confirm that realloc frees the original block of memory?
  23.  
  24. 3. How do you get a look at howmuch dynamic memory a process is using right down
  25. to the byte level
  26.     1.e ps will give %mem consumed, what I want to do is to print out how
  27. much is used, then calling my freeing function (which calls free on various
  28. parts of the struct) and then print out how much is left, so I can make sure
  29. that it's working.
  30.  
  31.     (The man page on our system mentions meminfo but the library malloc
  32. isn't around, so -lmalloc doesn't work. It's not in /usr/lib)
  33.  
  34. Please reply by email & I will post the answers,
  35.  
  36. Thanks for the help,
  37. Regards,
  38. GB.
  39.  
  40.  
  41. --
  42. | When it all gets too much,    | Garrett Burke,        |
  43. | take to the hills.        | JS Computer Engineering,    |
  44. |                | Trinity College Dublin.    |
  45. |                | gburke@unix2.tcd.ie        |
  46.