[net.lang.c] 4.2 malloc

riddle@im4u.UUCP (Prentiss Riddle) (09/11/85)

In article <5079@allegra.UUCP> jpl@allegra.UUCP (John P. Linderman) writes:
>
> 		 ...Another ``gotcha''  [in 4.2bsd malloc()]
>to beware of is that space, once allocated, is never broken
>into smaller pieces.  For example, if I allocate a 4 meg
>temporary workspace, free it, then allocate a 2 meg area,
>malloc will not reuse the freed space, it will try for a new
>area, and, thanks to the aforementioned quirks, it will fail
>with the standard 6 meg per-process limit.  Dunno if this is
>fixed under 4.3.

Does anyone know if this has been fixed in the Sun version of malloc()?

--- Prentiss Riddle ("Aprendiz de todo, maestro de nada.")
--- {ihnp4,harvard,seismo,gatech}!ut-sally!riddle   riddle@sally.UTEXAS.EDU
--- Leaving the net soon: friends can write for my new snail-mail address.

day@kovacs.UUCP (Dave Yost) (09/15/85)

Keywords:

In article <514@im4u.UUCP> riddle@im4u.UUCP (Prentiss Riddle) writes:
>In article <5079@allegra.UUCP> jpl@allegra.UUCP (John P. Linderman) writes:
>>
>> 		 ...Another ``gotcha''  [in 4.2bsd malloc()]
>>to beware of is that space, once allocated, is never broken
>>into smaller pieces.  For example, if I allocate a 4 meg
>>temporary workspace, free it, then allocate a 2 meg area,
>>malloc will not reuse the freed space, it will try for a new
>>area, and, thanks to the aforementioned quirks, it will fail
>>with the standard 6 meg per-process limit.  Dunno if this is
>>fixed under 4.3.
>
>Does anyone know if this has been fixed in the Sun version of malloc()?

I have a souped-up version of malloc derived from the 4.2 malloc
that reuses all available freed space before asking the system for
more.  Plus it does other neat things.  I was thinking of posting
it to net.sources sometime soon.

--dave yost