home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- 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
- From: gburke@unix2.tcd.ie (Garrett Burke)
- Subject: "FREE & Calloc & realloc"
- Message-ID: <gburke.724953776@unix2.tcd.ie>
- Summary: Does free 'really' work with realloc & calloc.
- Keywords: Free, memory
- Sender: usenet@cs.tcd.ie (NN required at ashe.cs.tcd.ie)
- Nntp-Posting-Host: unix2.tcd.ie
- Organization: Trinity College, Dublin
- Date: Mon, 21 Dec 1992 16:02:56 GMT
- Lines: 32
-
- Hi all,
- I have a program that's suffering from a memory leak (circ 12MB
- leaking!). I am allocating memory with calloc for some structures and with
- malloc for others, and then calling realloc on those pointers.
-
- Here's the query:
-
- 1. Does FREE free memory allocated with realloc & calloc?
- 2. Could you confirm that realloc frees the original block of memory?
-
- 3. How do you get a look at howmuch dynamic memory a process is using right down
- to the byte level
- 1.e ps will give %mem consumed, what I want to do is to print out how
- much is used, then calling my freeing function (which calls free on various
- parts of the struct) and then print out how much is left, so I can make sure
- that it's working.
-
- (The man page on our system mentions meminfo but the library malloc
- isn't around, so -lmalloc doesn't work. It's not in /usr/lib)
-
- Please reply by email & I will post the answers,
-
- Thanks for the help,
- Regards,
- GB.
-
-
- --
- | When it all gets too much, | Garrett Burke, |
- | take to the hills. | JS Computer Engineering, |
- | | Trinity College Dublin. |
- | | gburke@unix2.tcd.ie |
-