Skip to content
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

vala: avoid half-constructed vectors being garbage-collected. #421

Merged
merged 1 commit into from
Jul 16, 2019

Conversation

sgtatham
Copy link
Contributor

The clause in eval_ast() which evaluates each element of an input
vector into an output vector was holding the intermediate results in
an ordinary GLib.List, and putting them all into a vector at the end
of the evaluation. But that meant that nothing was preventing all
those values from being garbage-collected half way through.

Now we make an output Mal.Vector at the start of the process, and
point a GC.Root at it to ensure it stays around until we've finished
putting items in it.

This fixes the vala part of #418, I think.

The clause in eval_ast() which evaluates each element of an input
vector into an output vector was holding the intermediate results in
an ordinary GLib.List, and putting them all into a vector at the end
of the evaluation. But that meant that nothing was preventing all
those values from being garbage-collected half way through.

Now we make an output Mal.Vector at the start of the process, and
point a GC.Root at it to ensure it stays around until we've finished
putting items in it.

This fixes the vala part of kanaka#418, I think.
@kanaka
Copy link
Owner

kanaka commented Jul 16, 2019

Regular Travis build passed for Vala and I tested self-host locally and it passed. So Merged.

@sgtatham sgtatham deleted the eval-ast-vector-gc-fix branch July 16, 2019 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants