comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk>
Subject: Re: Memory Mapped Storage Pools.
Date: Tue, 25 Oct 2005 00:26:31 GMT
Date: 2005-10-25T00:26:31+00:00	[thread overview]
Message-ID: <pan.2005.10.25.00.26.36.368428@linuxchip.demon.co.uk.uk.uk> (raw)
In-Reply-To: pan.2005.10.26.22.16.09.200167@nowhere.net

On Wed, 26 Oct 2005 20:08:44 -0400, Freejack wrote:

> Ada Storage Pools, in Unix/Posix type environments, are typically
> handled via the omnipresent C malloc() routine. While this undoubtedly
> simplifies compiler/runtime development, it has left me desiring a
> mechanism with a bit more control.
> 
> So I've begun working on a library that allocates storage pools through
> the lower level mmap() suite of system utilities. I'm tentatively calling
> it Custom_Storage.Mapped_Pools
> 
> It's intended use is for very large allocations that are intended to be
> returned to the system upon finalization, rather than having the extra
> memory linger in the program's process "space".

I did this once, a few years ago.

The objective were:

1) Allow region-based allocation (zero space overhead!)
2) Allow conventional "malloc/free" style allocation within each pool
3) task compatible ("thread safe")
4) Able to reload pools from the mmapped files on subsequent runs
5) Pools able to expand as necessary

I used a completely free, open source allocator for the malloc/free
part of the code (in C), and did the high-level stuff from the Ada.

The mmap'ed blocks were mapped as the pool expanded, getting
larget maps each time.  The pool kept a fixed-size table
of all the regions allocated.

I don't think I have the code to hand, since it was not mine :(

The objectives above probably apply to your code too.  I think that
region-based allocation is an important and under-appreciated
approach to memory management.

I can't remember the exact details of the interface, but I don't
think you need bindings to mmap, since they are part of Florist
(I still use these in my current code).

Good luck!
-- 
Adrian
 



       reply	other threads:[~2005-10-25  0:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <pan.2005.10.26.22.16.09.200167@nowhere.net>
2005-10-25  0:26 ` Dr. Adrian Wrigley [this message]
2005-10-26  1:41 ` Memory Mapped Storage Pools Dan Baysinger
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox