At 10:16 AM 7/22/97 +0100, Nigel Metheringham wrote:
>We really need some volunteers to start looking carefully at the code for
>this sort of problem, and probably to change some coding practices to
>ensure it doesn't easily happen again.
>
>I like Lee's solution for making the buffer a dynamic string, *but* that
>then means we have to spend time cleaning up after ourselves - or just
>leak memory. Actually if we keep using processes up then we can just let
>the storage lifetime be that of the process and let the OS clean up after
>us.
The GNU alloc() function automatically disposes the memory as soon as you
leave the function that allocated it (it's allocated on the stack, and thus
goes away with the rest of the frame).
alloc() is a good replacement for local buffers. However, I don't know how
many platforms it is supported on.
Another possibility is using a more generalized garbage-collecting memory
manager. There are a few out there that I know of for C.
--
Jawaid Bazyar | Affordable WWW & Internet Solutions
Interlink Advertising Svcs | for Small Business
bazyar@??? | P.O Box 641 (303) 781-3273
--The Future is Now!-- | Englewood, CO 80151-0641 (303) 789-4197 fax