Malloc problems
John Kessenich
jk at hpfelg.HP.COM
Sat May 14 04:04:57 AEST 1988
A wild guess:
Malloc() has two behavoirs that combined might be causing your
problem.
1. When malloc() runs out of memory, it returns NULL.
2. Free does not necessarily return memory for malloc's
immediate re-use.
If you repeatedly malloc and free, you may actually be using
up memory. This leads to malloc eventually returning NULL,
which, if you dereference, can cause a core dump.
Free-ing memory in reverse order it was malloc'ed in may help.
John Kessenich
More information about the Comp.lang.c
mailing list