Always know your audience... ;-)

Let me start over as to make sure I'm not leading anyone astray...

Tcl can be built in one of two ways: single-threaded, which is the default,
or threaded, which requires you to configure things with the
"-enable-threads" flag. When you build Tcl with support for threads, the
threaded allocator, aka "Zippy," is enabled.

At a high level, the "Zippy" allocator is a x2 allocator which is optimized
around lock avoidance that comes at the cost of relatively high memory
overhead. Ultimately the "Zippy" allocator uses malloc() and free() for
block allocations, and mmap() for large allocations, but the allocated
blocks flow back and forth between a shared pool and per-thread pools. There
is also no automatic garbage collection. The allocator basically caches
memory in both shared and per-thread pools as to avoid having to go to the
system to get memory.

If you were to try and pre-load an alternate memory allocator for threaded
Tcl whichused the "Zippy" allocator by default, you wouldn't see much
difference, since the higher memory usage is a side affect of how the
"Zippy" allocator is functions - x2 bucket allocations, and how that
allocated memory is passed between the shared and per-thread pools.

What you need to do is build a version of Tcl that has support for threads,
but does not use the "Zippy" allocator. I seem to remember there being
issues with core Tcl that did not allow you to do this easily, but you'd
have to double check. Maybe try something like "--enable-threads
--disable-thread-alloc."

The newer zippy2 code exposes an environment variable that allows you to
turn off the threaded allocator at load time.

Example:

env -i TCL_ALLOC_DISABLE=1 LD_PRELOAD=libhoard.so bin/nsd ...

Setting the "TCL_ALLOC_DISABLE" environment variable will send all
allocations directly to malloc() and free() which can then be overridden by
the "LD_PRELOAD" of an alternate memory allocator.

Hope that helps?

On 12/13/06, aT <[EMAIL PROTECTED]> wrote:

 I understand developers might be able to understand what you mentioned ,
being a sysadmin it is a bit hard for me to understand LD_PRELOAD and
compiling tcl not to use threaded allocator .

 i would really appreciate  if the above mentioned "basically" paragraph
be explained more .
 *
"Basically what you need to do is compile Tcl so that it doesn't use the
threaded allocator, and instead uses regular malloc() and free(). "*

I tried in tcl source "./configure --help" to find out how can i do what u
mentioned , but could not find any help how to , not use,  threaded
allocator and instead use malloc() and free() .


*" Then compile tcmalloc,  "*

If i compile tcmalloc is this a standalone procedure or do i need to
mention aolserver location in anyway .


*
" and finally LD_PRELOAD tcmalloc at AOLserver startup time. This will
override malloc() and free()." *

How do i do that ?


Nathan Folkman wrote:

Basically what you need to do is compile Tcl so that it doesn't use the
threaded allocator, and instead uses regular malloc() and free(). Then
compile tcmalloc, and finally LD_PRELOAD tcmalloc at AOLserver startup time.
This will override malloc() and free(). Hope that helps!

- n

On 12/11/06, aT <[EMAIL PROTECTED]> wrote:
>
> Nathan Folkman wrote:
>
> Anyone tried Google's tcmalloc with AOLserver instead of using Tcl's
> threaded allocator? Looks like folks are seeing some good things with it.
>
> http://dammit.lt/2006/12/06/google-perftools-tcmalloc-squid/
>
> --
> Nathan Folkman
> [EMAIL PROTECTED]
>
>
> --
> AOLserver - http://www.aolserver.com/
>
>
> To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> with the
>
> body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.
>
>  I would like to try it , but have no clue how to compile this against
> aolserver.
> can anyone post a small howto on compiling it with aolserver ?
>
>
> --
> Syed Atif Ali
> D. +971 4 3911914
> F. +971 4 3911915
> ___________________________________________
> The sum of the intelligence on the planet is a constant; the population is 
growing.
>
>
> --
> AOLserver - http://www.aolserver.com/
>
>
> To Remove yourself from this list, simply send an email to <[EMAIL 
PROTECTED]> with the
>
> body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.
>
>


--
Nathan Folkman
[EMAIL PROTECTED]


--
AOLserver - http://www.aolserver.com/


To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
<[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.



--
Syed Atif Ali
D. +971 4 3911914
F. +971 4 3911915
___________________________________________
Walk softly and carry a megawatt laser.


--
AOLserver - http://www.aolserver.com/


To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.




--
Nathan Folkman
[EMAIL PROTECTED]


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to