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

[v9] backport 10915 (memory leak) #10927

Merged
merged 3 commits into from
Mar 8, 2022
Merged

[v9] backport 10915 (memory leak) #10927

merged 3 commits into from
Mar 8, 2022

Conversation

zmb3
Copy link
Collaborator

@zmb3 zmb3 commented Mar 8, 2022

Backports #10915

zmb3 added 2 commits March 7, 2022 17:30
Prior to this change, the bitmap data was copied into Go first
(via C.GoBytes), converted to RGBA, and then copied a second time
into the RBGA image that we pass to the PNG encoder.

Instead, use unsafe.Slice to get a slice backed by the Rust-managed
memory. Perform the RGBA conversion in-place here, and then perform
one copy from the Rust-managed memory into the Go RBGA image.
Pass Go a pointer to the CGOBitmap, otherwise Rust assumes ownership
is passing through the FFI and will not free the memory when we're
finished with it.
@zmb3 zmb3 enabled auto-merge (squash) March 8, 2022 13:57
@zmb3 zmb3 merged commit dbdaa7f into branch/v9 Mar 8, 2022
@zmb3 zmb3 deleted the zmb3/v9-backport-10915 branch March 8, 2022 14:48
@zmb3 zmb3 added the backport label Mar 8, 2022
@webvictim webvictim mentioned this pull request Apr 19, 2022
@webvictim webvictim mentioned this pull request Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants