Skip to content

free thread ctx on uc_vm_free when no longer being ref#388

Open
evertonen wants to merge 1 commit intojow-:masterfrom
evertonen:suggestion-issue-385
Open

free thread ctx on uc_vm_free when no longer being ref#388
evertonen wants to merge 1 commit intojow-:masterfrom
evertonen:suggestion-issue-385

Conversation

@evertonen
Copy link
Copy Markdown

fix #385

@evertonen evertonen force-pushed the suggestion-issue-385 branch from 1777701 to 366ef50 Compare March 23, 2026 23:35
@evertonen
Copy link
Copy Markdown
Author

No longer leaking as shown in the description of the issue:

root@33db7cc5518d:/ucode/examples# gcc -g -Wall execute-file.c -lucode
root@33db7cc5518d:/ucode/examples# 
root@33db7cc5518d:/ucode/examples# echo '{% z=x+y; print(z, "\n"); %}' > source.uc
root@33db7cc5518d:/ucode/examples# 
root@33db7cc5518d:/ucode/examples# ./a.out ./source.uc 
579
Program finished successfully.
Function return value is null
root@33db7cc5518d:/ucode/examples# 
root@33db7cc5518d:/ucode/examples# valgrind --leak-check=full --show-leak-kinds=all -s ./a.out ./source.uc
==712== Memcheck, a memory error detector
==712== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==712== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info
==712== Command: ./a.out ./source.uc
==712== 
579
Program finished successfully.
Function return value is null
==712== 
==712== HEAP SUMMARY:
==712==     in use at exit: 0 bytes in 0 blocks
==712==   total heap usage: 210 allocs, 210 frees, 20,853 bytes allocated
==712== 
==712== All heap blocks were freed -- no leaks are possible
==712== 
==712== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
root@33db7cc5518d:/ucode/examples# 

@evertonen evertonen requested a review from jow- March 24, 2026 16:04
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.

Example code leaves a memory leak

2 participants