>>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:

  DS> At 12:29 AM 9/21/2001 +0200, Bart Lateur wrote:

  >> >Horribly wasteful of memory, definitely, and the final allocation system
  >> >will do things better, but this is OK to start.
  >> 
  >> So to stop it waste memory, subtract 1 first and add it again later.

  DS> Nah, it'll still waste memory. It can't not, because of the way it
  DS> works.  It has to ask for a big gob of memory and ignore bits to
  DS> make sure it gets the alignment right. This particular
  DS> implementation's not all that efficient I'm sure, but it'll get
  DS> ripped out and replaced when we have a real memory management
  DS> system.

what about a binary type allocation system?

we have multiple allocation structures in an array with each one
allocating the next size up binary size. so the lowest level does say 32
bytes (or whatever our smallest granularity is). the highest level could
be in the multi-megabytes or larger. when a size is requested it go to
that size queue and if there is a free block on its list, it gets it. if
no block exists, it requests from a larger size and will break it
down. now, if you allocate with malloc and it is not on the proper,
boundary the preceding ram is broekn into smaller parts and put onthose
queues. so no (or little) ram is wasted. all blocks are allocated on
proper boundaries and you can do binary coallescing during (incremental)
GC.

a first request of a small block may allocate 32 (or some other 2**N) of
them in a large chunk. that large blocks are managed by just slice off
the leading chunk and moving a pointer so that is very fast. when the
block is gone and the queue is empty, a new larger block is allocated.

once the queues get populated some, it will be very fast.

lemme try to whip out something like this soon and see what happens. or
does anyone else want to hack it with or without me?

uri

-- 
Uri Guttman  ---------  [EMAIL PROTECTED]  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org

Reply via email to