Bug 20960 – -profile=gc does not track class objects allocated with new
Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-06-20T01:18:16Z
Last change time
2020-06-29T22:28:09Z
Assigned to
No Owner
Creator
Andrei Alexandrescu
Comments
Comment #0 by andrei — 2020-06-20T01:18:16Z
Building dmd itself with -profile=gc and then running it on a few simple files seems to show that only array allocations are traced, but not allocations of individual objects. dmd allocates many nodes for syntax elements, and their allocation would be interesting to trace.
Comment #1 by tim.dlang — 2020-06-20T08:13:56Z
Try using dmd -lowmem. Without this flag dmd will not use the GC.
Comment #2 by andrei — 2020-06-29T17:49:14Z
Built dmd with -profile=gc -lowmem, no avail. Individual allocations of class objects are not present in the log.
Comment #3 by stanislav.blinov — 2020-06-29T21:29:01Z
(In reply to Andrei Alexandrescu from comment #2)
> Built dmd with -profile=gc -lowmem, no avail. Individual allocations of
> class objects are not present in the log.
Build with -profile=gc. *Run* with -lowmem :)
Excerpt from a log:
524032 2047 dmd.mtype.TypeIdentifier dmd.parse.Parser!(ASTCodegen).Parser.parseBasicType dmd/parse.d:3725
479872 1304 dmd.dscope.Scope dmd.dscope.Scope.alloc dmd/dscope.d:154
377808 463 dmd.func.FuncDeclaration dmd.parse.Parser!(ASTCodegen).Parser.parseDeclarations dmd/parse.d:4778
162528 3386 dmd.expression.IdentifierExp dmd.parse.Parser!(ASTCodegen).Parser.parsePrimaryExp dmd/parse.d:7679
138752 271 dmd.dtemplate.TemplateInstance dmd.parse.Parser!(ASTCodegen).Parser.parsePrimaryExp dmd/parse.d:7675
124384 338 dmd.declaration.VarDeclaration dmd.parse.Parser!(ASTCodegen).Parser.parseDeclarations dmd/parse.d:4830
118528 463 dmd.mtype.TypeFunction dmd.parse.Parser!(ASTCodegen).Parser.parseDeclarator dmd/parse.d:4172
107456 292 dmd.declaration.VarDeclaration dmd.parse.Parser!(ASTCodegen).Parser.parseAutoDeclarations dmd/parse.d:1265
102816 126 dmd.func.UnitTestDeclaration dmd.parse.Parser!(ASTCodegen).Parser.parseDeclDefs dmd/parse.d:663
97152 1012 dmd.tokens.Token dmd.lexer.Lexer.allocateToken dmd/lexer.d:299
Comment #4 by andrei — 2020-06-29T22:28:09Z
(In reply to Stanislav Blinov from comment #3)
> (In reply to Andrei Alexandrescu from comment #2)
> > Built dmd with -profile=gc -lowmem, no avail. Individual allocations of
> > class objects are not present in the log.
>
> Build with -profile=gc. *Run* with -lowmem :)
Awesome, thanks! I finally got it going. I will then close this.