comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@alexandria.organon.com (Jon S Anthony)
Subject: Re: dynamic memory allocation
Date: 1997/06/18
Date: 1997-06-18T00:00:00+00:00	[thread overview]
Message-ID: <JSA.97Jun18154239@alexandria.organon.com> (raw)
In-Reply-To: 33A7B0B4.F75C277D@elca-matrix.ch


In article <33A7B0B4.F75C277D@elca-matrix.ch> Mats.Weber@elca-matrix.ch writes:

> > Whether it's bad or not will really depend on the specifics of the
> > application and the memory manager.  If the MM coaleces or compacts, I
> > don't see how _fragmentation_ will be a problem. [...]
> 
> Should be "coaleces _and_ compacts".

Well, no that is certainly not right.  If it compacts, coalecing is
irrelevant.  So, I guess you could claim that "if it coaleces, then it
needs to also compact".

> If it coaleces xor compacts, it is easy to construct a program that
> runs out of memory due to fragmentation.

Not for the compaction disjunct.  No way.

> Moreover, compaction is quite unlikely to happen on most
> implementations as it requires a double indirection or a GC-like
> scanning of all live pointers.

Yes, I would agree with this.


> What we do to minimize fragmentation is to allocate only blocks with
> sizes that are powers of two, and maintain one free list per power
> of two. It does waste some storage but the program runs well for
> long periods of time.

Yes this is a pretty standard trick (with various bases).  Buddy
systems are related, and they coalesce, and for an appropriate base
for your application, should avoid fragmentation issues reasonbly
well.

/Jon
-- 
Jon Anthony
OMI, Belmont, MA 02178
617.484.3383
"Nightmares - Ha!  The way my life's been going lately,
 Who'd notice?"  -- Londo Mollari




  reply	other threads:[~1997-06-18  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-16  0:00 dynamic memory allocation Stephen Leake
1997-06-16  0:00 ` Joel Seidman
1997-06-16  0:00 ` Samuel Mize
1997-06-17  0:00 ` Glen Cornell
1997-06-17  0:00 ` Jon S Anthony
1997-06-18  0:00   ` Mats.Weber
1997-06-18  0:00     ` Jon S Anthony [this message]
1997-06-17  0:00 ` Robert Dewar
1997-06-17  0:00   ` Spam Hater
1997-06-17  0:00     ` Robert Dewar
1997-06-17  0:00   ` Stephen Leake
1997-06-17  0:00     ` Michael F Brenner
1997-06-17  0:00     ` Brian Rogoff
1997-06-18  0:00 ` David Wheeler
1997-06-18  0:00   ` Stephen Leake
1997-06-19  0:00     ` Arthur Schwarz
1997-06-20  0:00     ` David Wheeler
1997-06-19  0:00   ` JP Thornley
1997-06-18  0:00 ` David Wheeler
  -- strict thread matches above, loose matches on Subject: below --
1997-06-19  0:00 Marin David Condic, 561.796.8997, M/S 731-93
replies disabled

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