Skip to content
Tcl Source Code View Ticket
Login

View Ticket

memory leak by any package require (trunk and windows only)

Closed / Invalida0df373abd7f81ad7754278d3f2518dafa79afe8Created 1 year agoUpdated 1 year ago
Descriptionmarkdown2025-07-19 16:44:56

9.1 seemed to get something (windows related) causing a leak by simple package require of any package, so this code shows mem-leak of ca. +11MB (+300% of initial mem-usage) in 30 seconds on windows (but no leak on unix platform):

  timerate {interp create i; i eval { package require platform }; interp delete i} 30000
thereby all other branches inclusive 8.6 and 9.0 don't show the leak on windows at all.

apnadkarniplain2025-07-20 02:21:09
What metric are you looking at. I tried to reproduce this (Win10) with 9.1rc0 and don't see any of the memory usage related values in process monitor and task manager grow at all. I checked shared, static and shared without zipfs.

Curiously, but not related to the ticket, the build without zipfs generates a couple of hundred thousand page faults while the zipfs builds generate none. I understand zipfs being in memory but still that many page faults in the non-zipfs case is surprising to me.
sebresmarkdown2025-07-20 12:01:31

All my builds are without zipfs (so one'd be able to develop or change sources of tcl-library, without to rebuild zipfs).
And I was not on 9.1rc0 but on current trunk.

Env: gcc 14.2 (MinGW-W64 x86_64-msvcrt-posix-seh)...

How it is build:

mkdir win/Release; cd $_
../configure --disable-zipfs
make tcltest

The issue:

./tcltest <<<'
proc memusage {} { regexp -inline {\d+} [exec wmic process where processid=[pid] get WorkingSetSize] };
puts [memusage];
timerate {
  timerate {interp create i; i eval { package require platform }; interp delete i} 3000;
puts [memusage];
} 30000
'

The metric is working set size (but the same would be for private bytes):

7880704
10469376
11571200
12693504
13955072
15065088
16216064
17309696
18522112
19595264

If you'd repeat it for 9.0, you'd see zero increase once the mem-manager buffered area grows to matched size of task (and gets frozen by ca. 9375744).

sebresmarkdown2025-07-20 12:46:42

trunk hasn't a leak built in temp folder (I prepared that for bisect), but definitely showed a leak in my projects folder.

It was something that didn't (re)compiled after update, make clean does the job and fixed it.

So the leak was a 3rd party issue, thus closed.

Log in (anonymous is fine) to add a comment.