digitalmars.D.bugs - [Issue 19455] New: GC wastes too much memory
- d-bugmail puremagic.com (39/40) Nov 30 2018 https://issues.dlang.org/show_bug.cgi?id=19455
https://issues.dlang.org/show_bug.cgi?id=19455 Issue ID: 19455 Summary: GC wastes too much memory Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: r.sagitario gmx.de The GC allocates in chunks that are a power of 2. This causes a lot of memory wasted: module waste; import core.memory; struct S { char[129] data; } void main() { GC.disable(); foreach (_; 0 .. 1000000) new S; } compile and run withwaste.exe --DRT-gcopt=profile:1Number of collections: 2 Total GC prep time: 0 milliseconds Total mark time: 0 milliseconds Total sweep time: 8 milliseconds Total page recovery time: 3 milliseconds Max Pause Time: 0 milliseconds Grand total GC time: 12 milliseconds GC summary: 247 MB, 2 GC 12 ms, Pauses 0 ms < 0 ms => even though only 129 MB are allocated, the GC needs 247 MB. With a struct size of 128, it needs 145 MB. --
Nov 30 2018