Bug 22985 – dip1008 implementation uses the GC behind the scenes

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P4
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-04-04T11:23:36Z
Last change time
2023-05-26T14:43:14Z
Assigned to
No Owner
Creator
RazvanN

Comments

Comment #0 by razvan.nitu1305 — 2022-04-04T11:23:36Z
int foo(int) @nogc { throw new Exception("huhu"); } void test() @nogc { try { foo(1); } catch(Exception e) { } } void main() { import std.stdio; import core.memory; auto stats1 = GC.stats(); test(); auto stats2 = GC.stats(); writeln(stats1); // Stats(0, 0, 0) writeln(stats2); // Stats(1376, 1047200, 1360) } Allocating the traceHandler still uses the GC
Comment #1 by destructionator — 2022-04-04T12:13:24Z
You probably could allocate the trace handler inline, either just have a static array (a certain length of stack information has no practical value anyway, so just truncating it surely good enough irl) or let the Exception dtor take care of it with a malloc/free pair internally on the private slice. I actually thought it used to do this but I might be remembering wrong.
Comment #2 by schveiguy — 2023-05-26T14:43:14Z
Huh, I missed this one. This should be fixed in 2.102 with the new trace handler.