-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
c-autofree-marker
commented out
#171
Comments
Ah, the We'll push out a new version of the utilities. In the meantime,
With this finalizer, you can attach it to all objects that So the
|
Another instance where the documentation is coming up short. For the |
OK - I tried to use that in the following manner:
I then created a test like this:
When I run this:
I'm using stanza version 0.17.33 in WSL. I expect the Is there some aspect of the unit test framework that I'm misunderstanding ? Can you replicate this behavior? I see the finalizer used in the |
Hi Carl, As far as I can tell, your code is correct, and the testing framework is also doing what it should. Are you expecting the The finalizer is executed when the If you execute a loop afterwards that does nothing except allocate a bunch of memory:
This will likely trigger the GC, and cause your finalizer to run. |
OK - I probably don't understand the GC very well. I was expecting the GC to collect the GVector object at two places:
When does the GC run ? Is there a heuristic for the GC ? |
Oh I see. Stanza works off of a different mental model for the GC, that is conceptually closer to Ruby/Java than to C++ destructors. The mental model is that Stanza starts up with a small heap of about 4MB, and begins executing your program. All allocations are taken from this heap, and so the heap gradually fills up until it is full. When it is full, it triggers a GC which sweeps through the 4MB and deletes the dead objects, and continues executing your program afterwards. We play tricks in the backend to make sure that the sweeping and deleting can be done very quickly. If the GC wasn’t able to clear up much space, then the heap is enlarged, and your program is resumed with a larger heap. For something like your |
OK - that is very helpful - thanks!
I agree that the |
Hi,
In your documentation for the Tetris example, you talk about
c-autofree-marker
and theLivenessMarker
object.In the stanza code here:
https://github.com/StanzaOrg/lbstanza/blob/229ee4e013e0f411742390f31bf97af159ddc1f1/core/core.stanza#L9771
This implementation is commented out. This causes the tetris example to not build on relatively new versions of stanza because it can't resolve
LivenessMarker
orc-autofree-marker
.What is the status of this code? I attempted to follow what was going on in the git history. From what I can tell - that code gets commented out in 7980585.
It seems to me like this is a pretty critical feature for creating sane wrappers around moderately complicated C libraries.
Is there an alternate or work around for this functionality?
The text was updated successfully, but these errors were encountered: