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

Allow the GC to run during ObjectiveC calls. #43

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Allow the GC to run during ObjectiveC calls. #43

merged 2 commits into from
Sep 19, 2024

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Sep 19, 2024

... by transitioning to GC-safe and back around the ccall.

Instead of changing our callbacks to change back to GC-unsafe, I just bumped the minimal Julia version to 1.10, as on 1.9+ @cfunction should automatically transition back.

I also had to roll our own ccall argument conversion (cconvert + unsafe_convert), because simply doing gc_enter + ccall + gc_leave (as we do in CUDA.jl) resulted in failed assertions due to the GC running during argument conversion. This is probably caused by ObjectiveC.jl having significantly more complex conversions (e.g. String -> NSString), but nonetheless this should probably be done in CUDA.jl too.

cc @vtjnash

Fixes JuliaGPU/Metal.jl#412, similar to JuliaGPU/CUDA.jl#2262.

@maleadt maleadt added the bug label Sep 19, 2024
@maleadt maleadt merged commit e2ebc4a into master Sep 19, 2024
3 checks passed
@maleadt maleadt deleted the tb/gcsafe branch September 19, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More sporadic 1.11 hangs
1 participant