> There are smarter people than me that can go into
> better detail, but
> I'll give it a shot.  All the memory allocators
> you're usually going
> to see grow your address space using brk(1)/sbrk(1).
>  They generally
> on't shrink the address space back down.
> 
> If you really need the address space to shrink (the
> common solution is
> just to let those pages get pushed out to the VM),
> try mmap() on a
> temporary file (or /dev/zero, but I donno if that
> works on solaris)
> and allocate memory out of that.  When you're done
> with that, just
> unmap the file and the address space is freed.  GNU
> malloc does this
> in certain situations.

It does work on Solaris; see
http://docs.sun.com/app/docs/doc/819-2254/zero-7d?a=view

where it says

> Mapping a zero special file creates a zero-initialized unnamed memory
> object of a length equal to the length of the mapping and rounded up to
> the nearest page size as returned by sysconf. Multiple processes can share
> such a zero special file object provided a common ancestor mapped the
> object MAP_SHARED.


--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to