Malloc problems

Dave Hammond daveh at marob.MASA.COM
Fri May 6 06:43:54 AEST 1988


Help!

I am currently working on an application which requires repeated
allocation of small chunks of memory to dynamically build various structure
lists. It is quite conceivable that the program will attempt to allocate
hundreds (even thousands) of small blocks within a tight loop. The
application the goes thru one pass successfully.

Problem: on subsequent passes (free old, read data, allocate new space)
malloc() core dumps. Traces show that the structure addresses have not
moved since the first pass (i.e. no pointer address screwups) and the
problem does not appear in smaller versions of the application (its currently
running on an Intel 286 machine under SCO Xenix, as a Large model
program - about 100K binary file size).

As a remedy I've written a set of routines which allocate large chunks
of memory on startup and then parcel out portions as necessary. This
seems to work, but should I have to do this?

Is the problem with a)Xenix, b)the malloc() package, c) ??

Thanks for any Help! in advance.

Dave Hammond
DSI Communications
333 W. Merrick Rd.
Valley Stream, NY 11580
E-Mail: ...!marob!daveh



More information about the Comp.lang.c mailing list