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

fix: gnark-ffi memory handling #1650

Merged
merged 1 commit into from
Oct 16, 2024
Merged

fix: gnark-ffi memory handling #1650

merged 1 commit into from
Oct 16, 2024

Conversation

ctian1
Copy link
Member

@ctian1 ctian1 commented Oct 16, 2024

char pointers and struct pointers returned from go FFI to rust must be deallocated in go as well. Particularly, we were using CString::from_raw on char pointers allocated in go, which is incorrect.

This PR exposes functions to free structs and strings allocated in go, and uses those instead.

Copy link

SP1 Performance Test Results

Branch: chris/gnark-ffi-fix
Commit: 44d94d2
Author: ctian1

program cycles execute (mHz) core (kHZ) compress (KHz) time success
fibonacci 11291 0.18 2.80 0.45 25s
ssz-withdrawals 2757356 10.84 117.41 38.21 1m12s
tendermint 12593597 5.28 235.96 106.01 2m1s

@ctian1 ctian1 merged commit ca71f2d into dev Oct 16, 2024
9 checks passed
@ctian1 ctian1 deleted the chris/gnark-ffi-fix branch October 16, 2024 18:55
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