Hi, This change hopefully fixes a memory leak in Embperl 3.0.0:
Output of valgrind running test suite without change: ==912727== ==912727== HEAP SUMMARY: ==912727== in use at exit: 25,119,424 bytes in 88,791 blocks ==912727== total heap usage: 1,183,812 allocs, 1,095,021 frees, 153,474,615 bytes allocated ==912727== ==912727== LEAK SUMMARY: ==912727== definitely lost: 50,430 bytes in 1,446 blocks ==912727== indirectly lost: 107,796 bytes in 42 blocks ==912727== possibly lost: 24,691,729 bytes in 87,116 blocks ==912727== still reachable: 269,469 bytes in 187 blocks ==912727== of which reachable via heuristic: ==912727== length64 : 28 bytes in 1 blocks ==912727== newarray : 59,824 bytes in 1,787 blocks ==912727== suppressed: 0 bytes in 0 blocks ==912727== Rerun with --leak-check=full to see details of leaked memory ==912727== ==912727== Use --track-origins=yes to see where uninitialised values come from ==912727== For lists of detected and suppressed errors, rerun with: -s ==912727== ERROR SUMMARY: 133 errors from 12 contexts (suppressed: 0 from 0) Output of valgrind running test suite with change: ==911443== ==911443== HEAP SUMMARY: ==911443== in use at exit: 25,081,636 bytes in 87,362 blocks ==911443== total heap usage: 1,183,979 allocs, 1,096,617 frees, 152,712,387 bytes allocated ==911443== ==911443== LEAK SUMMARY: ==911443== definitely lost: 28,230 bytes in 44 blocks ==911443== indirectly lost: 65,364 bytes in 29 blocks ==911443== possibly lost: 24,722,683 bytes in 87,103 blocks ==911443== still reachable: 265,359 bytes in 186 blocks ==911443== of which reachable via heuristic: ==911443== newarray : 63,240 bytes in 1,788 blocks ==911443== suppressed: 0 bytes in 0 blocks ==911443== Rerun with --leak-check=full to see details of leaked memory ==911443== ==911443== Use --track-origins=yes to see where uninitialised values come from ==911443== For lists of detected and suppressed errors, rerun with: -s ==911443== ERROR SUMMARY: 115 errors from 12 contexts (suppressed: 0 from 0) Proposed change is: diff -urN orig/Embperl-3.0.0/epparse.c Embperl-3.0.0/epparse.c --- orig/Embperl-3.0.0/epparse.c 2023-10-07 19:04:44.000000000 +0100 +++ Embperl-3.0.0/epparse.c 2025-01-03 10:33:06.519275400 +0000 @@ -140,6 +140,7 @@ { strncpy (r -> errdat1, "BuildTokenHash", sizeof (r -> errdat1)) ; sprintf (r -> errdat2, "%s => procinfo", pToken -> sText) ; + free(pSortTokenHash); return rcNotHashRef ; } if (strcmp (pKey, "embperl") == 0) @@ -147,6 +148,7 @@ else if (strncmp (pKey, "embperl#", 8) == 0 && (n = atoi (pKey+8)) > 0) embperl_CompileInitItem (r, (HV *)(SvRV (pSVValue)), pToken -> nNodeName, pToken -> nNodeType, n, ppCompilerInfo) ; } + free(pSortTokenHash); } In the current release version pSortTokenHash is allocated but never freed. Michael Stevens Senior Developer ▪︎ Dianomi +44 207 802 5530 <+44%20207%20802%205530> michael.stev...@dianomi.com 84 Eccleston Square London, SW1V 1PX www.dianomi.com -- This e-mail is for the sole use of the intended recipient and contains information that may be privileged and/or confidential. If you are not an intended recipient, please notify the sender by return e-mail and delete this e-mail and any attachments. Certain required legal entity disclosures can be accessed on our website.