Is there a limit on the number of threads you can create in an
interpreter? Out of no where, I started getting error messages
saying that the interpreter "can't create a thread". The man page
did not say anything on this.
The host OS, however, can enforce a limit if it wants, in which case
Tcl would eventually hit that limit if you create enough threads.
On 8/2/2023 6:26 PM, Rich wrote:
The host OS, however, can enforce a limit if it wants, in which case
Tcl would eventually hit that limit if you create enough threads.
Thanks for the info. This was on Windows 10. It must have been low
memory issue for me.
Linux, 1100 empty threads (just thread::create and nothing more), top
reports 12.6g of virtual memory used.
That works out to about 12mb per empty thread.
Rich <[email protected]d> writes:
Linux, 1100 empty threads (just thread::create and nothing more), top
reports 12.6g of virtual memory used.
That works out to about 12mb per empty thread.
This seems like a lot, so I tested it with an interactive tclsh. After loading the thread package top shows 5560k. Each thread::create adds
about 1000k. Do you have some other packages loaded in your program?
Joerg
Joerg Mertens <[email protected]> wrote:
Rich <[email protected]d> writes:
Linux, 1100 empty threads (just thread::create and nothing more), top
reports 12.6g of virtual memory used.
That works out to about 12mb per empty thread.
This seems like a lot, so I tested it with an interactive tclsh. After
loading the thread package top shows 5560k. Each thread::create adds
about 1000k. Do you have some other packages loaded in your program?
Joerg
Just a blank interactive tclsh (64 bit).
$ rlwrap tclsh
% package require Thread
2.8.7
% for {set i 0} {$i < 1000} {incr i} {thread::create}
%
And top reports, for the tclsh:
PID NI VIRT RES SWAP S %CPU %MEM TIME+ COMMAND 30010 0 11.8g 273760 0 S 0.0 1.1 0:02.84 tclsh
Only 273760 resident, but tclsh has allocaated 11.8g.
Just a blank tclsh (launched within rlwrap) shows as:
31029 0 6864 4636 0 R 0.0 0.0 0:13.47 tclsh
269k resident per thread -- but the virtual space itself balloons much
more.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (3 / 13) |
| Uptime: | 142:52:42 |
| Calls: | 12,089 |
| Calls today: | 2 |
| Files: | 14,998 |
| Messages: | 6,517,455 |