Re: GC performance - GC fragility



Micha Nelissen wrote:
Andre Kaufmann wrote:
Also I don't think that the native heap has a much better cache
locality. Think of a native heap which has

1000 entries of the type:

[60 bytes free] [40 bytes allocated] [60 bytes free] [40 bytes.....]

{ it's called heap fragmentation }

What will happen if the applications now wants to allocate 80 bytes ?
Every entry has to be checked and touched. Not quite local (for this
example).

What a load of nonsense. Why must a heap have this kind of structure?

Well it's easy to call something nonsense.
And before we start to nitpick the heap sample should read:

>> [61 bytes free] [40 bytes allocated] [62 bytes free] [40 bytes.....]

Otherwise the heap implementation would be just too dumb.


I haven't tested FMM regarding heap fragmentation. But anyways it can't prevent it since this is what memory compaction of GC heaps tries to prevent.


Tell me what a heap will look like after the following loop (pseudo code).


loop i from 1..1000

pos1 = alloc 60 bytes
pos2 = alloc i + 1 bytes
free oldPos2
oldPos2 = pos2

You normally will end with a heap looking like a swiss cheese. AFAIK FastMM tries to fight this with granularity and passing different allocation sizes to different "heap blocks", but it can't be IMHO generally be prevented.

It's a big problem of long running applications.

It
doesn't. E.g. just read the top part of FastMM source code. Please try
to have at least a bit of clue about a subject before drawing any
conclusions on it.


You seem to have more clue than I have and since I haven't studied FastMM source code could you shed some light on the problem how a native heap can (generally) prevent fragmentation, without compacting the memory ?

Micha

Andre
.



Relevant Pages

  • Re: Memory management terminology
    ... and let's assume that heap fragmentation is not the problem. ... a particual allocation pattern run OOM the machine even if there ... not on any smaller or larger chunk of memory. ...
    (microsoft.public.vc.language)
  • Re: What do you LISPers think of Haskell?
    ... Similarly the first fit heap management ... Heap fragmentation is less of a problem. ... Google's new web browser Chrome is written in C++. ...
    (comp.lang.lisp)
  • Re: CString mess HEAP in long running programs ?
    ... What kind of HEAP problem are you thinking about? ... For HEAP corruptions, the class CString alone used correctly will cause ... For HEAP fragmentation, generic C++ code that uses a lot of allocations ...
    (microsoft.public.vc.language)
  • Re: GC performance - GC fragility
    ... Think of a native heap which has ... 1000 entries of the type: ... {it's called heap fragmentation} ...
    (borland.public.delphi.non-technical)
  • Re: OutOfMemoryException is thrown
    ... > This object reads messages from a MSMQ queue. ... Harge Object Heap counters shows you the managed heap consumption, ... consumption (the managed heap itself is a native heap). ...
    (microsoft.public.dotnet.framework)