Page 1 of 1

memory leak in clforka()?

PostPosted: Sun Jan 17, 2016 1:22 pm
by pharaoh
i implemented Game Of Life on my parallella with STDCL and it works do far. But it seems, clforka() has a memory leak.

i call clforka() in a loop to evolve the world (one call evolves the whole world one step further):

while(generation < GENERATIONS) {
clforka(cp, devnum, krn, &ndr, CL_EVENT_WAIT, width, height, current_world, new_world);
ptr = new_world;
new_world = current_world;
current_world = ptr;
}

after some interations (about 95) i get

gol: e_alloc(): mmap failure.
gol:
ERROR: Can't allocate external memory buffer!

because the host process reached the 3GB process limit. Has anyone the same issue and can confirm it?

I will reimplement it using OpenCL, maybe it's a STDCL issue.

Re: memory leak in clforka()?

PostPosted: Sun Jan 17, 2016 1:40 pm
by pharaoh
Same problem with OpenCL. I found some posts about this issue ("problem with COPRTHR and newer ESDK"). It's really a pity, because with this huge memory leak the parallella is more or less useless to me. I will try to contact the COPRTHR developers, but it seems to be awful quiet around COPRTHR and ESDK, not much activity.

Re: memory leak in clforka()?

PostPosted: Mon Jan 18, 2016 4:48 am
by jar
The leak is not within COPRTHR. Until it's fixed, you can work around it with persistent threads. Basically, move your loop code into the kernel so that you don't have to return to the host. It will be higher performance also.

Re: memory leak in clforka()?

PostPosted: Mon Jan 18, 2016 7:09 pm
by pharaoh
yes, you're right, it's not clforka(), it's a bug in e_free(), the solution is there: viewtopic.php?f=48&t=3406