Re: Limiting resources used by scripts on web server



Alexandre Ferrieux wrote:
[...] it turns out it is
hard because (1) Tcl_Objs are allocated globally, and not bound to a
thread/interp,

Actually, they're thread-bound (there's a per-thread memory pool).

(2) to my knowledge there is no instrumentation to keep
track of how many Tcl_Objs were created by a given thread/interp.

On a thread level, if there isn't (I'd need to check the source to see
if there is when memory debugging is turned on) then it would be easy to
add. The real problems are that all other accounting is per-interpreter
(memory is often allocated in contexts where there is no interpreter to
account it against) and it is very difficult to recover from memory
allocation failures — almost the whole of Tcl assumes that Tcl_Alloc()
never ever fails, which is true right now and also massively simplifies
a lot of code — and everything is made more complex by the fact that any
recovery strategy will almost certainly need to allocate more memory
while it runs...

Donal.
.



Relevant Pages

  • Re: How to release heap memory that is marked as free
    ... As I said, fragmentation is a very serious problem, and one of the most serious problems ... my allocator was accused of using massive amounts of memory. ... I'm going to have to re-think the memory allocation that I'm ... process's 'working set'. ...
    (microsoft.public.vc.mfc)
  • Re: [PATCH 00/28] Swap over NFS -v16
    ... memory they can consume. ... So we need the extra (skb) ... included in the reserve? ... if the allocation had to dip into emergency reserves, ...
    (Linux-Kernel)
  • Re: Memory leak with CAsyncSocket::Create
    ... read my essay on how storage allocators work. ... Create method is consuming system memory that is not released back to ... The memory consumption is either shown as "Mem Usage" on the Task ... many levels of allocation going ...
    (microsoft.public.vc.mfc)
  • Re: OT: C++ overloading operators
    ... dynamic allocation, no matter how many "clever tricks" are used... ... though there's enough memory in the system, ... all these "flexible data types" map into CPU command ... The computing environment is completely ...
    (comp.dsp)
  • Re: HLA Lib
    ... All memory allocation is freed up when the process quits. ... reduce need to resize blocks for 98% string operations. ... HLA strings already consume. ...
    (alt.lang.asm)