Skip to content

Allow the GC to run during ObjectiveC calls.#43

Merged
maleadt merged 2 commits intomasterfrom
tb/gcsafe
Sep 19, 2024
Merged

Allow the GC to run during ObjectiveC calls.#43
maleadt merged 2 commits intomasterfrom
tb/gcsafe

Conversation

@maleadt
Copy link
Copy Markdown
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
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