Re: GC performance - GC fragility
- From: Andre Kaufmann <andre.kaufmann_re_move_@xxxxxxxxxxx>
- Date: Mon, 28 Jan 2008 22:40:19 +0100
Just an example (for discussion):
var i, current : cardinal;
p, oldp : pointer;
const alloc = 65538;
begin
oldp := nil;
current := 0;
try
for I := 1 to 10000 do begin
p := AllocMem(i * alloc); current := current + i * alloc;
AllocMem(alloc); current := current + alloc;
FreeMem(oldp); current := current - ((i - 1)* alloc);
oldp := p;
end;
except
Writeln(current);
end;
ReadLn;
end.
This sample throws an exception at 934,702,956 bytes on my computer.
I can allocate nearly the double size with a single call to AllocMem.
Either I have written the sample wrong, could be for sure, or the allocation granularity and overhead for heap management are > 100% of the data itself, or - what I assume - the heap is fragmented.
While I wouldn't call this a practice sample, it's still a sample that virtual memory can't move and fix the fragmentation holes.
If my sample isn't wrong ;-).
Andre
.
- Follow-Ups:
- Re: GC performance - GC fragility
- From: Martin Harvey
- Re: GC performance - GC fragility
- References:
- GC performance - GC fragility
- From: Eric Grange
- Re: GC performance - GC fragility
- From: Atmapuri
- Re: GC performance - GC fragility
- From: Andre Kaufmann
- Re: GC performance - GC fragility
- From: Micha Nelissen
- Re: GC performance - GC fragility
- From: Andre Kaufmann
- Re: GC performance - GC fragility
- From: Eric Grange
- Re: GC performance - GC fragility
- From: Andre Kaufmann
- GC performance - GC fragility
- Prev by Date: Re: A Tale of Two Memory Managers (long)
- Next by Date: Re: Nokia Acquires Trolltech
- Previous by thread: Re: GC performance - GC fragility
- Next by thread: Re: GC performance - GC fragility
- Index(es):