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

Use new style cffi callbacks? #197

Closed
almarklein opened this issue Oct 9, 2021 · 2 comments
Closed

Use new style cffi callbacks? #197

almarklein opened this issue Oct 9, 2021 · 2 comments

Comments

@almarklein
Copy link
Collaborator

almarklein commented Oct 9, 2021

https://cffi.readthedocs.io/en/latest/using.html#extern-python-new-style-callbacks

There have been reports of a specific memoryerror on MacOS M1 (see #190 and #136):

MemoryError: Cannot allocate write+execute memory for ffi.callback(). You might be running on a system that prevents this.

This looks to be a permission problem with the "old callback mechanism" that we're using. The cffi docs mention that the "new callback mechanism" does not have this problem. We only have 2 callbacks, so we might be able to fix this.

It is still a bit unclear when the error occurs - it seems to depend on a number of factors, like the Python env, conda vs pip, available brew installations, and the phase of the moon.

This was referenced Oct 9, 2021
@almarklein
Copy link
Collaborator Author

I took a look at this, but the new-style callbacks can only be used with the API level mode, which means that cffi generates some C code that is then compiled - you need a compiler at runtime.

If we really want to we can do this, but it makes this library much less friendly to hack on. Plus I got tons of errors related to undeclared identifiers for wgu-native stuff, so I'm not even sure how well this works.

So now I really hope that there is a consistent way to prevent that memoryerror on M1 Macs 🤞

@almarklein almarklein changed the title Use new style cffi callbacks Use new style cffi callbacks? Oct 9, 2021
@almarklein
Copy link
Collaborator Author

I think we can conclude that our current callbacks are fine.

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

No branches or pull requests

1 participant