dhinds@portia.Stanford.EDU (David Hinds) (02/08/91)
I'm a little confused about the use of the various malloc's when writing multiprocessing code. It looks to me like the fast malloc (the one you get with -lmalloc) uses the same scheme as the arena calls, like amalloc, which are part of the mpc library. So, what scheme does the malloc in mpc use? The slow malloc in the regular C library, or the fast kind? 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. -David Hinds dhinds@cb-iris.stanford.edu
micah@flobb4.csd.sgi.com (Micah Altman) (02/09/91)
In <1991Feb7.192217.11811@portia.Stanford.EDU> dhinds@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@csd.sgi.com "Computational Juggler" Phone (415) 335-1866