Skip Menu |

This queue is for tickets about the Devel-Size CPAN distribution.

Report information
The Basics
Id: 114705
Status: new
Priority: 0/
Queue: Devel-Size

People
Owner: Nobody in particular
Requestors: john.deighan [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.80
Fixed in: (no value)



Subject: doesn't work with thread::shared variables
I have a variable named $hCachedLists, declared as: our $hCachedLists : shared = shared_clone({}); I've added a bunch of data to it, but total_size() reports it as having 248 bytes. However, if I use Data::Dumper to dump it out, then get the data back using eval on the resulting string, then total_size() reports a size of 12,584,293 bytes (which is correct - I've seen the Data::Dumper output and I know how much data I've put into it). Below is the function that I use. I've run this with the variable $UseDumperForSharedVars both true and false, which is where I get the numbers below. FYI, the calling function uses the is_shared() method of threads::shared to decide whether to use this function. Also, I'm using ActivePerl on Windows 10 if it makes any difference. # ------------------------------------------------------------------- sub sharedVarSize { my($valueref, $nameWSigil) = @_; my $nBytes; my $source; if ($UseDumperForSharedVars) { local $Data::Dumper::Purity = 1; my $str = Dumper($valueref); my $VAR1; my $rc = eval($str . "return 1;"); return 0 if !$rc; $nBytes = total_size($VAR1); $source = 'Dumper'; } else { $nBytes = total_size($valueref); $source = 'total_size'; } trace("$nameWSigil = $nBytes bytes ($source)"); return $nBytes; } # sharedVarSize()