In the last episode (Jan 29), Murat Balaban said: > Are there any issues that i should now about memcpy and > multithreading in FreeBSD? I've got a code which reads: > > memcpy(&(h.req), req, sizeof(struct request));
What are the values of h and req at the time of segfault? You might want to try running with MALLOC_OPTIONS=J, which makes sure you don't accidentally use free'd memory, or assume that malloced memory is zeroed. If you see pointers with values near 0xD0D0D0D0, you have found a bug in your code... > and I keep getting SIGSEGV there in FreeBSD but not in Linux. > > PS: Of course, I protect the write operation with a mutex. Mutexes will protect you from someone stepping on your memory while you're copying. They don't protect you from seg faults if you have the wrong pointers in the first place. -- Dan Nelson [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message