clReleaseMemObject problem

Hi.

I apologize for my English.

I have a program that runs fine when the CONTEXT I have defined a GPU.
When I define a CPU, the program freezes when it reaches the line
clReleaseMemObject (memObjects [0]);
after a while, it quits without error and without end.

Deputy of the code.

My config:
Windows 7 64b
CPU Phenom 2 710
Ati 5750
jorg 1.4 b1

Atthach part of the code.

while (!wordS.isEmpty()) {
Pointer dst = Pointer.to(dstArray);

		cl_mem memObjects[] = new cl_mem[3];

		// Set the arguments for the kernel
		memObjects[0] = clCreateBuffer(context, CL_MEM_READ_ONLY
				| CL_MEM_COPY_HOST_PTR, Sizeof.cl_float * n, wordS.get(0)
				.getSrcPointerA(), null);
		memObjects[1] = clCreateBuffer(context, CL_MEM_READ_ONLY
				| CL_MEM_COPY_HOST_PTR, Sizeof.cl_float * n, wordS.get(0)
				.getSrcPointerB(), null);
		memObjects[2] = clCreateBuffer(context, CL_MEM_WRITE_ONLY,
				Sizeof.cl_float * n, null, null);

		// Set the arguments for the kernel
		clSetKernelArg(kernel, 0, Sizeof.cl_mem, Pointer.to(memObjects[0]));
		clSetKernelArg(kernel, 1, Sizeof.cl_mem, Pointer.to(memObjects[1]));
		clSetKernelArg(kernel, 2, Sizeof.cl_mem, Pointer.to(memObjects[2]));

		// Set the work-item dimensions
		long global_work_size[] = new long[] { n };
		long local_work_size[] = new long[] { 1 };

		// Execute the kernel
		clEnqueueNDRangeKernel(commandQueue, kernel, 1, null,
				global_work_size, local_work_size, 0, null, null);

		// Read the output data
		clEnqueueReadBuffer(commandQueue, memObjects[2], CL_TRUE, 0, n
				* Sizeof.cl_float, dst, 0, null, null);

		
		
		System.out.println(wordS.get(0).getPalabra()+" "+new String(dstArray, 0, dstArray.length - 1));
		wordS.remove(0);
		//Release memory objects
		clReleaseMemObject(memObjects[0]);
		clReleaseMemObject(memObjects[1]);
		clReleaseMemObject(memObjects[2]);

}

Hello

The code looks straightforward (like a part of the basic sample, enclosed in a ‚while‘ loop). So there’s nothing wrong with the code itself. No error message makes it even harder to do „remote debugging“.
I’m not aware about any problems with this function.

Did you really check with something like

System.out.println("before");
clReleaseMemObject(memObjects[0]);
System.out.println("after");

whether clReleaseMemObject is really the problem? Internally, this function does not do much that could go wrong… :confused:

bye
Marco

Thanks for your response.

Use the lines of code you sent and the program ends in BEFORE.

It seems that clReleaseMemObject gives a problem.

If you want to send the entire program so you can try.

You can send the program to