G'day boleary,

I ran a few tests and can confirm your findings.

I made a very small change to your code to confirm completion:
Was: if (time() - $lastUpdate > 1) {
Now: if (time() - $lastUpdate > 1 or $_ == 5000000) {
And added the shebang: #!/usr/bin/env perl
Other than that, I ran exactly the code you posted
(modified code: C:\Users\ken\tmp\pm_11147080_tk_mem.pl).

I have Cygwin running on Win10:

$ uname -a CYGWIN_NT-10.0-19044 titan 3.3.6-341.x86_64 2022-09-05 11:15 UTC x86_6 +4 Cygwin

I have Perlbrew with a variety of Perl versions, each with Tk installed. I ran

ken@titan /cygdrive/c/Users/ken/tmp $ ./pm_11147080_tk_mem.pl

successfully to completion, without any error or warning messages, with these Perl & Tk combinations: 5.30.0/804.034, 5.32.0/804.035 & 5.36.0/804.036 (each using ~5.5GB memory, from visual inspection of Task Manager).

I don't use the MSWin side of my machine very often, doing nearly all of my work with Cygwin; however, I did have an old Strawberry Perl version with Tk:

Microsoft Windows [Version 10.0.19044.2075] (c) Microsoft Corporation. All rights reserved. C:\Users\ken\tmp>perl -v This is perl 5, version 26, subversion 3 (v5.26.3) built for MSWin32-x +64-multi-thread ... C:\Users\ken\tmp>perl -E "use Tk; say $Tk::VERSION" 804.034

I ran the script three times:

C:\Users\ken\tmp>perl pm_11147080_tk_mem.pl C:\Users\ken\tmp>perl pm_11147080_tk_mem.pl Free to wrong pool 25e3ed0 not 10e38400 at pm_11147080_tk_mem.pl line +43. C:\Users\ken\tmp>perl pm_11147080_tk_mem.pl Free to wrong pool 25c3ed0 not 2ee60830 at pm_11147080_tk_mem.pl line +43.

Each run died at about 4GB memory usage (from visual inspection of Task Manager) with the Tk application completely shutting down. Like you, I either got "Free to wrong pool ..." or no output at all. With the added shebang and a blank line after it, my line 43 should be the same as your line 41:

$MAIN_WINDOW->update();

I had a look in "Active bugs for Tk" but nothing really looked like it was relevant to this. There's apparently 144 in the list; I could have missed something; a second pair of eyes wouldn't hurt.

I would definitely advise raising a bug report. Before you do that, though, I'd await further reports from other monks. The more specific information you can supply, the easier it will be for maintainers to track down the problem. The type of such information could be, but is not limited to:

I acknowledge that you may already know this. You can consider it as a useful checklist for others.

— Ken


In reply to Re: Perl Tk crashes when mem usage exceeds 4G on Win10 by kcott
in thread Perl Tk crashes when mem usage exceeds 4G on Win10 by boleary

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.