Re: Having memory leak issues with perl-c
Mark Murawski <[email protected]> Fri, 12 Aug 2022 18:26:08 -0400
| Newsgroups | gmane.comp.lang.perl.quality-assurance |
|---|---|
| Message-ID | <[email protected]> |
--------------ZN018gqAYLpSh0GbTfN0TSDn Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 8/12/22 18:11, Mark Murawski wrote: > On 8/4/22 15:10, demerphq wrote: >> On Thu, 4 Aug 2022 at 17:04, Mark Murawski >> <[email protected]> wrote: >> >> On 8/4/22 02:50, demerphq wrote: >>> On Thu, 4 Aug 2022 at 01:58, Mark Murawski >>> <[email protected]> wrote: >>> >>> I'm still not getting something... if I want to fix the >>> code-as-is and do this: >>> >>> FNsv = get_sv("main::_FN", GV_ADD); >>> if (!FNsv) >>> ereport(ERROR, >>> (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), >>> errmsg("couldn't fetch $_FN"))); >>> >>> save_item(FNsv); /* local $_FN */ >>> >>> >>> I dont get the sequence here. You take the old value of >>> $main::_FN and then you localize it after you fetch it? That >>> seems weird. >> >> >> You did not respond to this comment ^^ > > > The reason for the save_item*( was because I was modeling this code on > another section that uses save_item() to accomplish something similar > (to send internal postgres details to some perl). I don't know why > the original author uses save_item() for this purpose. > Oh... I know why save_item is used. It's because this code can be executed multiple times in the same perl process. So each one needs it's own _FN --------------ZN018gqAYLpSh0GbTfN0TSDn Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div class="moz-cite-prefix">On 8/12/22 18:11, Mark Murawski wrote:<br> </div> <blockquote type="cite" cite="mid:[email protected]"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <div class="moz-cite-prefix">On 8/4/22 15:10, demerphq wrote:<br> </div> <blockquote type="cite" cite="mid:CANgJU+W95nxb9HB_EEXUo3KDYqx-1xe14TZmJG_v-RBD=evZpw@mail.gmail.com"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <div dir="ltr"> <div dir="ltr">On Thu, 4 Aug 2022 at 17:04, Mark Murawski <<a href="mailto:[email protected]" moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>> wrote:<br> </div> <div class="gmail_quote"> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div> <div>On 8/4/22 02:50, demerphq wrote:<br> </div> <blockquote type="cite"> <div dir="ltr"> <div dir="ltr">On Thu, 4 Aug 2022 at 01:58, Mark Murawski <<a href="mailto:[email protected]" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>> wrote:<br> </div> <div class="gmail_quote"> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div> <div>I'm still not getting something... if I want to fix the code-as-is and do this:<br> </div> <br> FNsv = get_sv("main::_FN", GV_ADD);<br> if (!FNsv)<br> ereport(ERROR,<br> (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),<br> errmsg("couldn't fetch $_FN")));<br> <br> save_item(FNsv); /* local $_FN */<br> </div> </blockquote> <div><br> </div> <div>I dont get the sequence here. You take the old value of $main::_FN and then you localize it after you fetch it? That seems weird.</div> </div> </div> </blockquote> </div> </blockquote> <div><br> </div> <div>You did not respond to this comment ^^</div> </div> </div> </blockquote> <br> <br> The reason for the save_item*( was because I was modeling this code on another section that uses save_item() to accomplish something similar (to send internal postgres details to some perl). I don't know why the original author uses save_item() for this purpose.<br> <br> </blockquote> <br> Oh... I know why save_item is used. It's because this code can be executed multiple times in the same perl process. So each one needs it's own _FN<br> <br> <br> </body> </html> --------------ZN018gqAYLpSh0GbTfN0TSDn--