[Issue 19455] New: GC wastes too much memory
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 30 19:47:31 UTC 2018
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 at puremagic.com
Reporter: r.sagitario at 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 with
>waste.exe --DRT-gcopt=profile:1
Number 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.
--
More information about the Digitalmars-d-bugs
mailing list