pebal / sgcl

Smart Garbage Collection Library for C++
zlib License
167 stars 9 forks source link

Force-trigger a GC pass #4

Closed arcanis closed 7 months ago

arcanis commented 1 year ago

It'd be useful for testing purposes to have a way to trigger a forced synchronous GC pass, and get back the amount of objects that the collector managed to release.

pebal commented 7 months ago

I'm sorry it took so long, but I had to change the code structure and fix some errors.

I added the collector::force_collect() method with an optional parameter to wait for the cycle to complete. I also added the collector::live_object_count() method that returns the current number of live objects.

pebal commented 7 months ago

I also added the collector::live_objects() method, which allows you to get a list of live objects.