[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    mm shared memory library evaluation (Re: Bloating)
From:       <pbrown () redhat ! com>
Date:       1999-06-06 22:46:20
[Download RAW message or body]

I am currently evaluating the mm shared memory library by Ralf Engelschall
and the Apache project et. al.

It looks good.  Very good.

The API is almost identical to the malloc api if you want to use an
implicit global memory pool.  You can use several explicit shared pools as
well through a very similar API.  It supports nice locking as well.  It
hides what kind of shared memory allocation and/or locking it is doing on
each platform as well, making is completely portable.  Nice.

Even better, it tries very hard to prevent memory from fragmenting when
allocating, so that memory holes are not created.  From the man page:

        Allocation
           When a chunk of memory has to be allocated, the
           internal list of free chunks is searched for a
           minimal-sized chunk which is larger or equal than the
           size of the to be allocated chunk (some sort of a best
           fit algorithm).

           When a chunk is found which matches this best-fit
           criteria, but is still a lot larger than the requested
           size, it is split into two chunks: One with exactly
           the requested size (which is the resulting chunk) and
           one with the remaining size (which is immediately re-
           inserted into the list of free chunks).

           When no fitting chunk is found at all in the list of
           free chunks, a new one is created from the spare area
           of the shared memory segment until the segment is full
           (in which case an out of memory error occurs).

       Deallocation
           When a chunk of memory has to be deallocated, it is
           inserted in sorted manner into the internal list of
           free chunks.  The insertion operation automatically
           merges the chunk with a previous and/or next free
           chunk when possible, i.e.  the free chunks stay
           physically seamless (one after another) in memory, to
           automatically form larger free chunks out of smaller
           ones.

           This way the shared memory segment is automatically
           defragmented when memory is deallocated.

       This strategy reduces memory waste and fragmentation
       caused by small and frequent allocations and deallocations
       to a minimum.

All of this sounds very good to us.  I suggest that we find candidates for
shared memory in KDE, and possibly add the mm library to kdesupport.

---
  Preston Brown                                    Systems Engineer
  pbrown@redhat.com                                Red Hat, Inc. 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic