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

Avoid free call in interpreted mode #12496

Merged

Conversation

straight-shoota
Copy link
Member

This is a workaround for an interpreter bug (#12495) and basically restores the status before #12456.

This is a workaround for an interpreter bug (crystal-lang#12495) and basically
restores the status before crystal-lang#12456.
@straight-shoota straight-shoota added topic:stdlib:text kind:regression Something that used to correctly work but no longer works topic:compiler:interpreter labels Sep 18, 2022
@asterite
Copy link
Member

asterite commented Sep 18, 2022

But for this we also need to bind free and the others to the GC. Otherwise memory will leak.

@straight-shoota
Copy link
Member Author

Yes. But this didn't happen in interpreted mode before #12456 either, so we're just reverting to that state.

# TODO(interpreted): remove this unless
{% unless flag?(:interpreted) %}
LibPCRE.pcre_malloc = ->GC.malloc(LibC::SizeT)
LibPCRE.pcre_free = ->GC.free(Void*)
{% end %}

@straight-shoota straight-shoota added this to the 1.6.0 milestone Sep 18, 2022
@straight-shoota
Copy link
Member Author

@straight-shoota
Copy link
Member Author

Doh 🤦 It's flag?(:interpreted), not flag?(:interpreter). I think I've fallen to that footgun before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:regression Something that used to correctly work but no longer works topic:compiler:interpreter topic:stdlib:text
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants