Re: Tcl under conditions of high memory usage.



neuronstorm@xxxxxxxxx wrote:
Hi,

I have at various times had core dumps with Tcl under conditions of
fairly high memory usage, both on windows & FreeBSD.
I hardly expect applications to run properly when there is little free
memory - but is it normal for the app to just crash?
I sometimes get an error reported, something like: can't allocate
memory for tcl_listobj

It would help to get the precise message as my grep has no -like option.

Other daemons & applications will just grind their way along slowly -
whilst the system uses it's swap space heavily - but my Tcl daemons
just crash, well before the machine seems really overloaded.

Sorry for the lack of specific figures and scientific analysis - It's
just an impression I get about the behaviour of Tcl under load at this
stage, and I'd like to know what the expected behaviour is, or if
others have similar experiences.

Tcl will panic on many OOM conditions - something we have to work at
improving. The panic occurs when Tcl_Alloc fails to allocate the
requested size (this boils down to "when malloc fails to allocate the
requested size").

Depending on what you are doing, this might occur on an unloaded system too:
while 1 {set a([incr i]) $i
for example will swap until it dies with a malloc failure on a fresh
system. If you're in a hurry, the following does the same but faster:
set a {}; while 1 {lappend a $a}

So, apart from Tcl's suboptimal behaviour, your statement that "my Tcl
daemons just crash, well before the machine seems really overloaded"
might hint at some leak in your daemons.
.



Relevant Pages

  • Re: Memory allocation problem in 8.4.5
    ... I am using a Network simulator ... that uses the TCL as the interface to the core C++ part. ... which it is unable to allocate more memory and a series of "unable to ... I should also mention that TCL is unable to allocate ...
    (comp.lang.tcl)
  • Memory allocation problem in 8.4.5
    ... that uses the TCL as the interface to the core C++ part. ... The simulations ... which it is unable to allocate more memory and a series of "unable to ... I should also mention that TCL is unable to allocate ...
    (comp.lang.tcl)
  • Re: Are there any plan to fix the memory leaks in TCL?
    ... The memory leak is present in 8.3 and 8.4 on all platforms. ... >Tcl, as well as the purify report (please attach it as a file, do not ... The Tcl maintainers take memory hygiene *very* ... and only reflect respect for the gravity of your report. ...
    (comp.lang.tcl)
  • Re: Memory used by tcl script
    ... Gerald W. Lester wrote: ... >> It seems to me as if the amount of allocated mEmory stays on the level ... Tcl does its own memory management and does not ... many don't like the high-water-mark facets of such allocators. ...
    (comp.lang.tcl)
  • Re: get RAM size
    ... Returns the total number of bytes in system memory. ... The total Memory in the JVM is NOT equal to the RAM size of the computer, it's usually much less, and depends on how much memory you give to java when you start it. ... I was told there's no way to get the total RAM size from a java app, that's why I was looking for such a function in Tcl. ...
    (comp.lang.tcl)