Added arena free macro for cleanup and clarity

This commit is contained in:
2025-10-18 11:39:47 -05:00
parent 7f40dd92d6
commit 254958046a
4 changed files with 5 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ int main(void){
a = ARENA(0,nbytes); /* try 1GB */
if (!a.beg)
RAISE(OOM);
free(a.beg);
ARENA_FREE(a);
}
EXCEPT(OOM) {
/* handle memory failure gracefully */
@@ -20,7 +20,7 @@ int main(void){
}
FINALLY {
/* cleanup if needed, runs always */
if (a.beg) free(a.beg);
if (a.beg) ARENA_FREE(a);
}
END_TRY;