in reply to Win10: Getting popup "Perl Interpreter has stopped working"

I think the Array-of-array is becoming too big due to autovivification, see this simple example:

fbrm@monastery:~$ perl -MData::Dumper -E '$Q=$A[4][6]; say Dumper \@A' $VAR1 = [ undef, undef, undef, undef, [] ];

See how there are many undef's in the array (not sparse)... so you must change your code to probe first for existence of the array spot, and only then ask for the value (to avoid autovivification). Now, when creating the AoA, you also get this (perl -MData::Dumper -E '$A[4][6]=11;say Dumper \@A') so maybe switch to Hashes/HoH?

EDIT: added a better example with seemly only a 'read', here is the old example, which is clearly an assign:

fbrm@monastery:~$ perl -MData::Dumper -E '$A[4]="hi"; say Dumper \@A' $VAR1 = [ undef, undef, undef, undef, 'hi' ];

edit2: You can check this hypothesis with profiling heap memory usage on perl

Replies are listed 'Best First'.
Re^2: Win10: Getting popup "Perl Interpreter has stopped working"
by AllBackJack (Initiate) on Feb 04, 2017 at 16:22 UTC

    Thanks for your reply. I think you are close to the source of the problem, in it has to do with array sparseness or compaction.

    What I found is that I have an AOA (with some sub-AOA's), and items are deleted or splice'd out. All the operations on the top @array look "simple", no ref's to routines or anything.

    Yet when it came to removing the last item of an array by a splice (e.g. splice( @array, 0, 0) it seemed to work but later on I get the fault. If I instead put a check before the splice and did

    if( scalar( @array ) > 1 ) { splice(@array,$i,0); } else { @array = (); }

    the exception goes away.

    I'm not sure that this is really solving the problem, or just pushing it elsewhere.

    This script is old and has been working for eons (although only used a couple times a year). The incoming data naturally changes. However, strawberry perl itself does get updated and although I doubt it I'm wondering if something got changed in perl such that this is now showing up.

    While trying to find a solution to this problem I did find this posting in PerlMonks from January 25, 2017 and I'm wondering if there is possibly some underlying cause (I do use HOH's and ENV items): http://www.perlmonks.org/?node_id=1180341

      If you suspect it is because of a slow march into Unicode, Try putting use bytes; at the beginning of your code. Who knows... it might work.
      (some caveats apply. For example, if your perlscript file itself has a BOM or is not ascii, see perlunicode)

      how about installing virtualbox for Windows, then downloading a live ISO from any modern linux, and try your data on Linux. If your program does not die, then it's a Windows only artifact. And you might want to add your findings to the bug in the hope it gets more priority/attention.

      Or, find an older version of perl, and install that on a Windows machine, and test that out. Of course, you have one year, by then, hopefully, the bug is fixed.