HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.14k stars 656 forks source link

[hl] add std.hl.Gc.getLiveObjects feature for next hl version #11599

Closed yuxiaomao closed 6 months ago

yuxiaomao commented 7 months ago

https://github.com/HaxeFoundation/hashlink/pull/657 Count and get live objects of the given type in the GC. (It also works with other types than Class such as Enum, but should not be very common usage I think?)

Usage:

hl.Gc.getLiveObjects(h2d.col.Point.PointImpl, 5);
hl.Gc.getLiveObjects(std.Type.resolveClass("h2d.col.PointImpl"), 5);
yuxiaomao commented 6 months ago

@Simn Is there anything special that need to be taken into accounts, or I'm free to merge?

Simn commented 6 months ago

std/hl is basically the Wild West to me, so feel free to go nuts! I only care about CI being green in that regard.