-
Notifications
You must be signed in to change notification settings - Fork 547
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
[osx] Avoid the use of AutoreleasePool #1941
Comments
If you really want to handle it within gfx, then I suppose the choices are
When I started writing this, I was leaning on 1. with some hesitance, but going through the downsides while writing, 2. seems to be the safe bet, it's always correct, and the downsides shouldn't be that bad. I guess it would be nice to have a helper, like It's a bit late, I'm rambling :P |
Thanks for the great summary @scoopr! As mentioned on Gitter the performance of choice 2 seems like it could be fine, based on some performance tests (like this one). How did you know that libSDL does this, just by glancing through the source code? |
I've got some rich insights from our graphics team (@jrmuizel and @mstange):
Thus, we might be seeing a lower level solution here, potentially. Some preliminary ideas:
Also cc @tomaka @francesca64 |
On macOS, the implementation of @willglynn knows a lot more about Cocoa than I do, so can hopefully offer more concrete advice on how to proceed. |
I don't think My proposed solution to event loop problems in rust-windowing/winit#237 involves coroutines: user code runs on the usual stack, MacOS event loop runs on a different stack, and they cooperatively yield into each other. This addresses the mismatch where both APIs expect to call into the other, but I had not considered how this would interact with autorelease pools. (The only Objective-C objects I've come to believe that |
Then you are only left with the problem when you are not using I believe it has been perfectly okay to run the cocoa runloop on your own terms, there is just more stuff to take care of (like autorelease pools), and I guess thats how many of the wrapper libs like sdl/glfw etc. work. But that is actually not really possible on iOS (and android as well), and only way to run code is through platform provided hooks, there might be workarounds with separate threads. I suppose |
@scoopr As you note, mobile platforms don't fit the "you call the runloop" model. Web doesn't fit either – and in fact web requires both "The runloop calls you" works everywhere. |
Related to #1619 and #1779
It's unfortunate to have the autorelease pool managed by our examples. Need to investigate if we can completely automate it.
cc @grovesNL @scoopr @JohnColanduoni
The text was updated successfully, but these errors were encountered: