Re: Tcl under conditions of high memory usage.



On Nov 30, 5:48 am, "neuronst...@xxxxxxxxx" <neuronst...@xxxxxxxxx>
wrote:

Why does it have to error or panic?
Why can't it just wait?
It seems to me that a low memory condition on a machine may just be a
transient state,

Precisely when it's "transient" it's not an error at malloc() level.
Basically there are two situations:

- either the requested block fits in the VM (i.e RAM+swap has
enough free space *AND* the VM layout is not too fragmented so that
the heap can be grown contiguously to contain it), in which case
malloc() will succeed immediately. Further accesses may be slow due to
paging, which is your "transient" situation. But no failure.

- or the block doesn't fit, and malloc() fails definitively and
immediately.

Moreover, in the Linux case there is an additional "lie": the second
case nearly never occurs. Instead malloc says OK, and the access
itself may trigger a pass of OutOfMemoryKiller, which is a global
kernel mechanism hunting for memory-eaters with a delicate algorithm
balancing memory footprint, age, and recent activity. Notably it
doesn't simply kill the unfortunate requester, which may merely be
malloc'ing a 4k block...

This means that heavy code tweaking in the Tcl core might be a waste
in some OSes because anyway the kernel will take over before we can do
anything. No idea of the precise list though.

-Alex
.



Relevant Pages

  • Thank You -- Thomas J. Gritzan
    ... Thomas -- Your suggestion to malloc() out a block of memory was the ... Below are some details of my memory issues ... ... As a work around solution I guessed a ram disk would solve the ... persistence will frustrate the off topic police and give them a target ...
    (comp.lang.c)
  • Re: Simple question about headers and malloc!
    ... Therefore I am making all of its declarations ... memory (using malloc) and then exit back to main. ... allocation, I get data strored from the second allocation... ...
    (microsoft.public.vc.language)
  • Re: ten thousand small processes
    ... Stack needs to be executable for the current signal trampoline ... the use of malloc() that is causing your primary ... if there is any heap memory in use at all, no matter what you do, ... either directly, as a 4M page mapping (not used for user processes, ...
    (freebsd-performance)
  • Re: Help with Enter and Leave Instructions
    ... >>> for Memory Accesses, ... > The only standard way to do it is via malloc. ... Uh, SBRK/BRK is a standard, documented system call. ... > I really don't understand the objection to using C libraries. ...
    (alt.lang.asm)
  • Re: virtual memory leak? (was: Re: strange problem.....)
    ... and after some time I break this connection. ... executable in heap analyser and still there are no traces of memory ... The debugger is exceedingly programmable, too, ... I'm not a particular fan of malloc and free, ...
    (comp.os.vms)