Use of malloc with multiprocessing code

Micah Altman micah at flobb4.csd.sgi.com
Sat Feb 9 07:19:03 AEST 1991


In <1991Feb7.192217.11811 at portia.Stanford.EDU> dhinds at portia.Stanford.EDU (David Hinds) writes:

>I want to use the fast malloc, but I don't need the semaphoring stuff
>in the arena calls.  Should I link with -lmalloc and -lmpc?  When I do
>this, I get linker warnings about duplicate definitions of the malloc
>functions.

If you link with both you will only get one. Instead, link with -lmpc,
and use the usconfig(3P) call to turn off semaphoring in your malloc calls.
(use the CONF_STHREADMALLOCOFF ). Do this call before you create your
parallel threads. If you do this, you must make sure that you aren't
making calls to malloc in parallel.

B.T.W. - An additional difference between -lmalloc and -lmpc malloc calls 
is that mallocs made with when linked with -lmpc are quad-word aligned
rather than double word alligned. This can be important for cache line alignment
and graphics DMA transfers.

 Hope this helps.
--
	"Entia non sunt multiplicanda sine necessitate." - William of Ockham

	Micah Altman				micah at csd.sgi.com
	"Computational Juggler"			Phone (415) 335-1866



More information about the Comp.sys.sgi mailing list