Prev: Ann: Gnocl gets own URL/
Next: Compiling
From: Glenn Jackman on 4 Mar 2010 11:27 At 2010-03-04 11:17AM, "igor.g" wrote: > On Mar 1, 12:36�am, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com> > wrote: > > The high-water mark method means that a repeated, > > identical allocation should reuse the same resources without a single > > byte of overhead. > > proc mem_test {} { > set str [string repeat 0 [expr {1000*1000}]] ;# 1 MB > } > mem_test > > If I understand the issue, the only way to release memory is to use > rename mem_test {} > Am I right ? My understanding is the only way to release the memory is [exit] -- Glenn Jackman Write a wise saying and your name will live forever. -- Anonymous
From: Alexandre Ferrieux on 4 Mar 2010 13:19 On Mar 4, 5:17 pm, "igor.g" <igor.gilya...(a)gmail.com> wrote: > On Mar 1, 12:36 am, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com> > wrote: > > > The high-water mark method means that a repeated, > > identical allocation should reuse the same resources without a single > > byte of overhead. > > proc mem_test {} { > set str [string repeat 0 [expr {1000*1000}]] ;# 1 MB} > > mem_test > > If I understand the issue, the only way to release memory is to use > rename mem_test {} > Am I right ? No. See bug 2960042 for an explanation of the two kinds of allocations in Tcl and the consequences. In the specific case you're mentioning it is a vanilla malloc, that is freed as soon as the proc exits. -Alex
From: blacksqr on 4 Mar 2010 16:27 I found an interesting dicussion thread that illuminates the problem of memory allocation and garbage collection in general, and compares approaches taken by several dynamic languages (Ruby, Java, Python, Tcl, etc.): http://www.ruby-forum.com/topic/137642 Bottom line, memory management/garbage collection is always hard, but desire to do it right seems to get stronger as a tool gets put to more use.
From: Tcl Bliss on 4 Mar 2010 21:22 At one point I decided to test if the memory would be released if I run my code (if possible) in threads. Basically, create a thread, run my code, release the thread. I hoped that memory would be automatically given back to the system. In fact, the opposite seems to be true. Each created and released thread claims additional chunk of memory and the memory is never released, at least that's what I noticed in my experiment. That would make usage of one time threads in long running applications (like web servers) impractical. Of course, I would use long running threads or thread pools, but using threads as memory management tool has been ruled out.
From: Alexandre Ferrieux on 5 Mar 2010 03:00
On Mar 5, 3:22 am, Tcl Bliss <tcl.bl...(a)gmail.com> wrote: > > [...] but using threads as memory management tool has been ruled out. > Heh. QOTW candidate ? -Alex |