Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!ames!ncar!news.miami.edu!umiami!chuck From: chuck@umiami.ir.miami.edu (Chuck Urwiler) Newsgroups: comp.sys.mac.programmer Subject: THINK C's malloc(),free() help please Message-ID: <1991Apr6.203939.8742@umiami.ir.miami.edu> Date: 7 Apr 91 01:39:39 GMT Organization: Univ of Miami Music Engineering Lines: 33 I'm writing in THINK C on the Mac. I need to know just how malloc() (calloc() actually) and free() work. Right now, free() doesn't seem to be working. I pass it all the nodes of a list to free() and then I try a new malloc() and get a totally different pointer - why? Shouldn't I get a pointer down low in memory again, or at least one of the old pointers? Maybe I just need to malloc() more stuff to see it work? That's not that important. I just want to know that if I calloc() a bunch of nodes, and then free() them, that I'm definitely freeing up the space the pointers used. I'm not into my own memory management yet, but if this doesn't work right, I guess I'm gonna hafta do my own. Any insightful comments, help, references, whatever - it would all be appreciated. And, since it seems this is a common misunderstanding on the net, maybe you should just go ahead and post replies. By the way, the THINK C manual says absolutely NOTHING about malloc() or free() or anything. Only a reference in the standard library manual. By the way, if you're a THINK C programmer, I just got the new Mac Programming primer volume two - for those of you wondering about the memory manager and Text Edit, this is the book to buy. (but it doesn't say anything about malloc() !) -Chuck- -- Chuck Urwiler University of Miami Music Engineering Voice & Keys =========================================================================== chuck@umiami -or @umiamivm (Bitnet) |"Sometimes, the one thing that you're chuck@umiami.ir.miami.edu (Internet) | looking for, it's the last thing on chuck@miavax.ir.miami.edu (Internet) | your mind" -Robbie Nevil curwiler (PAN) | =========================================================================== Disclaimer: I only work and learn at this University. I don't speak for it!