You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Michael Stevens <mi...@dianomi.com.INVALID> on 2025/01/03 10:56:44 UTC
Embperl 3.0.0 memory leak fix
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.stevens@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.
Re: Embperl 3.0.0 memory leak fix
Posted by Jim Tappe <jt...@gmail.com>.
+1
On Fri, Jan 3, 2025 at 3:57 AM Ruben Safir <ru...@mrbrklyn.com> wrote:
> thank you
>
> On Fri, Jan 03, 2025 at 10:56:44AM +0000, Michael Stevens wrote:
> > 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.stevens@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.
>
> --
> So many immigrant groups have swept through our town
> that Brooklyn, like Atlantis, reaches mythological
> proportions in the mind of the world - RI Safir 1998
> http://www.mrbrklyn.com
>
> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
> http://www.nylxs.com - Leadership Development in Free Software
> http://www2.mrbrklyn.com/resources - Unpublished Archive
> http://www.coinhangout.com - coins!
> http://www.brooklyn-living.com
>
> Being so tracked is for FARM ANIMALS and extermination camps,
> but incompatible with living as a free human being. -RI Safir 2013
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
Re: Embperl 3.0.0 memory leak fix
Posted by Ruben Safir <ru...@mrbrklyn.com>.
thank you
On Fri, Jan 03, 2025 at 10:56:44AM +0000, Michael Stevens wrote:
> 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.stevens@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.
--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Embperl 3.0.0 memory leak fix
Posted by em...@actevy.io.
Hi Michael,
thanks for spotting this. I will include the fix in the next release
Regards
Gerald
> Michael Stevens <mi...@dianomi.com.invalid> hat am 03.01.2025 11:56 CET geschrieben:
>
>
> 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 tel:+44%20207%20802%205530
> michael.stevens@dianomi.com mailto:michael.stevens@dianomi.com
> 84 Eccleston Square London, SW1V 1PX
> http://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.
>