malloc() problems...

kevin l spier spier at madison.steinmetz
Wed Aug 10 17:27:27 AEST 1988


Hi -

I am new to this group so please bear with me if this question
has been asked and answered before. I have two pieces of C code
written independently of each other which are having similar problems
with malloc() [actually they call calloc() and never malloc()
directly]. The problem is that after allocating memory without problem
yet another call is made to calloc(). Calloc() in turn calls malloc()
which dies with a segmentation violation.  This behavior occurs at
different points in each of these two pieces of code, but occurs
consistently for each piece.

None of the calls to calloc() return a NULL pointer so it doesn't seem
that this has anything to do with running out of virtual memory (btw, the
total amount of memory being requested is always < 1 Mbyte).  I am also
assuming that a segmentation fault is not a standard error
notification for malloc().

This problem occurs on both a SUN 2 and Sequent Balance 21000 running
SUNOS 3.4 and Dynix 3.0.4 (both 4.2 bsd derivatives) respectively. I
tried using malloc_debug() on the Suns but it was very flaky giving
inconsistent reports on the heap's state.

Is this a known problem with malloc() for bsd 4.2 derivatives? 
If anyone has any suggestions on how to go about correcting, working
around, and/or isolating this problem [like a pd allocator which has
good diagnostics] please let me know.

Thank you.

Kevin L. Spier
spierk at turing.cs.rpi.edu



More information about the Comp.unix.wizards mailing list