<br><br><div class="gmail_quote">On Wed, Jun 23, 2010 at 10:35 PM, Mike Stok <span dir="ltr"><<a href="mailto:mike@stok.ca">mike@stok.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div><div></div><div class="h5"><br><div><div>On Jun 23, 2010, at 7:22 PM, Fulko Hew wrote:</div><br><blockquote type="cite"><br>I'm in the process of developing a module, and during a very simple<br>test (when the program exits, and things get auto-cleaned-up, I get the<br>
following error message:<br><br>Attempt to free unreferenced scalar: SV 0x8c1cc28, Perl interpreter: 0x8c1c008.<br>
<br>I know I'm probably doing something wrong somewhere, or better put:<br>'I'm not doing something I should be doing', but...<br><br>Whats the process of trying to figure out whats causing this error?<br>
How do I find out what was in the variable at '0x8c1cc28'?<br>If I knew that, I may be able to figure out whats wrong.<br><br>Suggestions anyone?<br></blockquote></div><div><br></div></div></div>What version of perl? I have seen problems reported with 5.10.0 which were fixed in 5.10.1 e.g. <a href="http://www.gossamer-threads.com/lists/engine?do=post_view_printable;post=245361;list=perl" target="_blank">http://www.gossamer-threads.com/lists/engine?do=post_view_printable;post=245361;list=perl</a></div>
</blockquote></div><br>Specifically version 5.8.8.<br>And yes, I saw the issues with specific versions, but I felt it was an issue with<br>my code. I've solved it (details below), but my generic question remains:<br>
<br>"Given a memory address, how can I dump the contents of the associated variable?"<br><br>I see a number of modules on CPAN to: dump the internal structure of scalars,<br>dump symbol tables, dump memory usage of variables, etc.<br>
but not a 'dump the variable at a memory location'.<br><br>If I had something like that, I could have seen the value of the data, and<br>immediately recognized where that data was being generated and stored.<br><br>
OK... Back to _my_ problem.<br><br>It turned out that I was storing a global variable into a hash element inside an object.<br>Once I made it a 'my' variable, the problem went away. The (bad) pseudo code would be:<br>
<br>foreach $name (@names) {<br> MYCLASS->new(name=>$name);<br>}<br><br>whereas it should have been:<br><br>foreach my $name (@names) {<br>
MYCLASS->new(name=>$name);<br>
}<br>
<br>