Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^5: In need of a Dumper that has no pretentions to being anything else.

by fergal (Chaplain)
on Feb 23, 2005 at 04:19 UTC ( #433566=note: print w/replies, xml ) Need Help??

in reply to Re^4: In need of a Dumper that has no pretentions to being anything else.
in thread In need of a Dumper that has no pretentions to being anything else.

Try the following patch to Data/ . Also, turn off Deepcopy as in my first post. It should make a huge difference. I'll file a bug and submit the patch.
--- ./ok/Data/ 2005-02-22 20:17:13.000000000 -0800 +++ ./ok/Data/ 2005-02-22 20:16:47.000000000 -0800 @@ -405,7 +405,7 @@ my $ref = \$_[1]; # first, catalog the scalar - if ($name ne '') { + if ($s->{deepcopy} and ($name ne '')) { ($id) = ("$ref" =~ /\(([^\(]*)\)$/); if (exists $s->{seen}{$id}) { if ($s->{seen}{$id}[2]) {
Updated And do $Data::Dumper::Useperl = 1;

Replies are listed 'Best First'.
Re^6: In need of a Dumper that has no pretentions to being anything else.
by BrowserUk (Pope) on Feb 23, 2005 at 05:10 UTC

    Hmm. I made the one-line change and turned Deepcopy off. The result was that it still crashed (using the example above). The difference was that the memory consumption grew much more quickly though it may have topped out at a lower or the same point, but it crashes at this point with:

    The instruction at 0x2808756d caused an access violation attempting to access memory at 0x000000004

    The code at the reported location disassembles as:

    Disassembly of Function perl58.dll!Perl_my_socketpair + 0x0F90 (0x2808 +756D) + 0x2808756D: MOV DWORD PTR [EDI+0x4],EAX 0x28087570: MOV DWORD PTR [EDI],ECX 0x28087572: MOV DWORD PTR [EDI+0x8],ESI 0x28087575: MOV DWORD PTR [ECX+0x4],EDI 0x28087578: MOV EAX,DWORD PTR [ESI] 0x2808757A: MOV ECX,ESI 0x2808757C: CALL DWORD PTR [EAX+0x10] 0x2808757F: LEA EAX,DWORD PTR [EDI+0xC] 0x28087584: RET 0x4

    though I suspect that the failure is caused through Perl not detecting that it had been refused a further allocation of memory. I don't seem to get the "Out of memory" message any more? (Since 5.8.4 and/or my moving from NT4 to XP--I am not sure which is responsible?)

    At the pointer of failure, though the stack could have been corrupted by this point, the stack contents are:

    PID: 988 TID: 332 - Stack Contents for 0x2808756D 0x2808756D: perl58.dll:Perl_my_socketpair + 0x0F90 0x2800F40A: perl58.dll:Perl_hv_fetch_ent + 0x091C 0x2800E9EC: perl58.dll:Perl_hv_store + 0x002C 0x10003325: 0x100028A6: 0x10003014: 0x10001A4D: 0x28040F9F: perl58.dll:Perl_sv_compile_2op + 0x7D9C 0x2805F811: perl58.dll:Perl_runops_standard + 0x000C 0x2808A3B1: perl58.dll:RunPerl + 0x0086 0x00401012: perl.exe+0x00001012 0x77E814C7: GetCurrentDirectoryW + 0x0044

    And the registers are:

    PID: 332 TID: 332 - Register Contents at EIP: 0x2808756D EAX: 0x00223FFC EBX: 0x00200000 ECX: 0x525DC288 EDX: 0x00220608 EDI: 0x00000000 ESI: 0x00223FF8 ESP: 0x0140F2FC EBP: 0x0140F34C EIP: 0x2808756D Flags: 0x00010246 o D i s Z a P c

    If you want the same information for the crash with the pre-patched Data::Dumper let me know.

    Update: Golly gee willickers this is fun! Try to be helpful and some miserable toerag who hasn't the guts to stand up and argue his case, vents by downvoting.

    Well get this. If your a saint, it'll only take you another 1000 days to wipe me out. If you use all your votes on downvoting me, every day. And if noone else ever opvotes me. So, you got 2.7 years to waste?

    Examine what is said, not who speaks.
    Silence betokens consent.
    Love the truth but pardon error.
      Sorry, I should have said that for that patch do have any affect at all you need also to do $Data::Dumper::Useperl = 1;. Otherwise you're probably running the C version which still has the bug.

        That indeed does prevent the crash and cut the memory consumption to around 445 MB. It runs somewhat more slowly as you would expect.

        I haven't tried this with Useperl=1 without the patch, but I can if that would be useful?

        With memory consumption still being 2 1/2 times that of the structure being dumped, it doesn't alleviate the problem with my real data, but if a bug gets fixed, that's good in itself. Thanks for taking the time to investigate.

        Examine what is said, not who speaks.
        Silence betokens consent.
        Love the truth but pardon error.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://433566]
[LanX]: good morning
[choroba]: LanX good indeed
[choroba]: very cloudy here, I planned to make some picrures, but now I don't think so
[LanX]: do you like it better now?
[choroba]: Well, getting used to it
[LanX]: several people told me they like saigon. ..
[choroba]: well, beer is good here, surprisingly
[choroba]: also, I discovered several vegan/vegetarian restaurants, so I can avoid meat
[LanX]: ha ha ... happy Czech :)
[choroba]: been to the War Remnants Museum, too. Quite a brutal experience

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2017-02-26 04:31 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (371 votes). Check out past polls.