In the specification we can read :
cl_int clReleaseMemObject (cl_mem memobj) decrements the memobj reference count. After the memobj reference count becomes zero and commands queued for execution on a command-queue(s) that use memobj have finished, the memory object is deleted. …
Does this “commands” include ndrange queueing with an argument that point to this memobj?