general SGI Question: malloc thread-safe?

New Message Reply Date view Thread view Subject view Author view

From: Volz, Bill (WRVO) (WRVO++at++chevron.com)
Date: 04/17/2001 06:14:30


A slightly off topic question: Is malloc thread safe?

I have an app that allocates memory in the main and frees it in a thread
before it dies. I'm getting symptoms of memory corruption. When I free the
memory in the main, the problems disappear. The books I have installed show
thread occurring only three times and none of the man pages on malloc says
anything about threading. I tried malloc_ss.so and it didn't indicate any
memory problems, even though they still occurred. The man page for pthreads
indicate malloc is not thread safe since sbrk is not thread safe, but it
doesn't say anything about free.

What about fwrite? Are the I/O routines thread safe (assuming only one
thread is writing to a stream).

Thanks,

William R Volz - Senior Research Geophysicist
Chevron Petroleum Technology
Voice: 281-596-2059 Fax: 281-596-3009


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Apr 17 2001 - 06:14:49 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.