[opensource-dev] Mesh viewers and tcmalloc issues

Carlo Wood carlo at alinoe.com
Sun Oct 2 07:39:49 PDT 2011


On Sun, 2 Oct 2011 10:20:47 +0200
Henri Beauchamp <sldev at free.fr> wrote:

> Really, the only true motivation behind the use of tcmalloc in mesh
> viewers (it was not use for non-mesh viewers) is to provide aligned
> allocations. Without it, and the way the mesh viewer code is written,
> the viewer simply crashes as soon as it tries to perform an SSE2
> operation on an unaligned structure.

Use _mm_malloc, if that doesn't exist use posix_memalign
and if that also doesn't exist, just use malloc.
That will work (for sse2 alignment).

tcmalloc is to get speed from not having to lock
threads when they allocate memory: they each have
their own pool. I never saw any evidence that the
main thread is waiting considerable long times
(ie > 10 usec) on a lock in malloc because other
threads are trying to alloc/free memory, so I don't
see the need for tcmalloc in the viewer. I think
LL fell in love with it for their server, but the
decision to use it for the viewer is wrong. 

-- 
Carlo Wood <carlo at alinoe.com>


More information about the opensource-dev mailing list