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

Add a GC.@preserve when calling unsafe_transcode! #216

Merged
merged 1 commit into from
May 28, 2024

Conversation

mkitti
Copy link
Member

@mkitti mkitti commented May 28, 2024

Add GC.@preserve when calling unsafe_transcode! since buffer to memory conversions involve raw pointer conversions.

Copy link
Member

@nhz2 nhz2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell there are a lot of missing GC.@preserve in unsafe_transcode!.
Unless Julia automatically preserves all function inputs?

@mkitti
Copy link
Member Author

mkitti commented May 28, 2024

From what I can tell there are a lot of missing GC.@preserve in unsafe_transcode!. Unless Julia automatically preserves all function inputs?

Currently, I think the GC.@preserve might be implicit becuase input and output are used latter in the function. Also the flow control with @goto may be difficult to optimize. However, a future optimization could do some kind of struct splitting, garbage collecting part of input or output in the future.

As far as I can tell, I think preserving the function input should be sufficient for the allocated memory to remain stable for the duration of the function call.

@mkitti mkitti merged commit 8541891 into JuliaIO:master May 28, 2024
25 checks passed
@nhz2 nhz2 mentioned this pull request May 31, 2024
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

Successfully merging this pull request may close these issues.

2 participants