If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Problem with pthreads and memory management

Hello ! I'm new there, long time lurker though.

I started a week ago to code a Mandelbrot / Buddhabrot renderer (I have poor C++ skills). Then, I decided this week-end to make my program running on multiple CPU cores. I managed to get the code done, but it crashes randomly, and more frequently the more you add simultaneous threads.

gdb on mac has this recurrent error when the code decides to crash :
*** set a breakpoint in malloc_error_break to debug
test(3964,0xb0103000) malloc: *** error for object 0x102ae00: pointer being freed was not allocated

(I code on windows, though)

It seems I lack a correct memory management, but I have absolutely no idea where (tried a few things). You can edit the number of threads running at line 197. My hunch is that the problem lies with the "new" i do at line 200. I need this pointer in order to pass it as an argument to the method called by the thread, so that the method can write its part of the image directly from the thread.

If somebody could help me, it would be great =) My head is kinda exploding right now =\