|
|
Darren New <dne### [at] sanrrcom> wrote:
> Warp wrote:
> > Oh, you have discovered a method to completely avoid memory
> > fragmentation? :-o Is it efficient?
> Yes, and yes.
That would mean that the memory allocation engine knows ahead of time
the order in which objects will be "forgotten" (ie. nothing points to them
anymore so they can be freed) so that it can group them in contiguous
memory. Of course this is impossible (not even by analyzing the program
because the order in which objects are "forgotten" may depend on things
like user input).
The only other alternative is that it performs memory defragmentation
before freeing the objects. But that doesn't sound any faster than
freeing the objects directly. (Memory defragmentation is something
useful per se, but doesn't sound like a fast way of freeing objects
in highly fragmented memory before the defragmentation has happened.)
Oh, of course there's a third possibility: It doesn't free objects if
freeing them would cause fragmentation. But then they would consume
memory even though they are not used. Doesn't sound reasonable if that
memory would be needed for something else.
--
- Warp
Post a reply to this message
|
|