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 destructor for struct Circom_Circuit to release dynamically allocated memory and prevent memory leaks. #22

Merged

Conversation

yushihang
Copy link
Contributor

@yushihang yushihang commented Mar 14, 2024

close #23

@yushihang yushihang changed the title Add a destructor for struct Circom_Circuit to release dynamically allocated memory and prevent memory leaks. Dratf: Add a destructor for struct Circom_Circuit to release dynamically allocated memory and prevent memory leaks. Mar 14, 2024
@yushihang yushihang changed the title Dratf: Add a destructor for struct Circom_Circuit to release dynamically allocated memory and prevent memory leaks. Draft: Add a destructor for struct Circom_Circuit to release dynamically allocated memory and prevent memory leaks. Mar 14, 2024
@yushihang yushihang marked this pull request as draft March 14, 2024 13:34
@yushihang yushihang changed the title Draft: Add a destructor for struct Circom_Circuit to release dynamically allocated memory and prevent memory leaks. Add a destructor for struct Circom_Circuit to release dynamically allocated memory and prevent memory leaks. Mar 14, 2024
@yushihang yushihang marked this pull request as ready for review March 15, 2024 00:10
@OBrezhniev OBrezhniev requested review from nixw4 and olomix March 15, 2024 10:58
src/calcwit.cpp Outdated Show resolved Hide resolved
@yushihang
Copy link
Contributor Author

I would like to kindly bring to your attention that, while this approach does not fully adhere to the RAII (Resource Acquisition Is Initialization) principle, it does address the issue of memory leaks and is the minimal modification required to the code. :-)

Considering that the code for the three structs, IODef, IODefPair, and Circom_CalcWit, are organized/maintained together, future maintainers will find it convenient to make consistent modifications to the existing code.

Therefore, the current implementation approach was adopted.

@OBrezhniev OBrezhniev merged commit bd5dc5e into 0xPolygonID:main Apr 9, 2024
3 checks passed
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.

Memory allocated in struct Circom_Circuit / IODefPair / IODef may not be correctly released
4 participants