Path: utzoo!utgpu!watmath!att!ucbvax!hplabs!hpfcdc!stroyan
From: stroyan@hpfcdc.HP.COM (Mike Stroyan)
Newsgroups: comp.sys.hp
Subject: Re: Freeing memory in starbase Display Lists
Message-ID: <5570267@hpfcdc.HP.COM>
Date: 16 Aug 89 17:50:21 GMT
References: <1035@esatst.yc.estec.nl>
Organization: HP Ft. Collins, Co.
Lines: 26

> When running a sbdl program I use delete_all_segments to delete all my
> current segments. However it appears that the memory used by the
> deleted display list is not freed. Anyone know how I can free this memory?
> -- 
> Neil Dixon

The display list is using malloc() and free() to allocate and release
the memory.  The call to delete_all_segments() will result in calls to
free() all of the malloc'd memory, but the malloc library does not
reduce process size when memory is freed.  The free memory is placed on
a list of free memory that can be used by future malloc operations.

If you only want to be able to malloc more memory, then you have no
problem.  If you want to reduce the size of the process to use less swap
space, then you have a problem with no easy answer.  The malloc(3C) and
malloc(3X) libraries use the brk(2) and sbrk(2) kernel calls to allocate
additional data space.  They never reduce the data space.  You would
need to replace the malloc library with one that will reduce the data
space when possible.  There is only a limited chance of reduction being
possible.  All malloc'd memory above a given address must have been
freed before the data space can be reduced to that maximum address.  If
any library has malloc'd memory above the large block of memory used by
display list segments, then the former display list memory can not be
released from the data space.

Mike Stroyan, stroyan@hpfcla.hp.com