bug(?) report: Visual profiler strange crash when using events

I wish I could change the topic of this thread.

First of all: I’m running the pre-release OpenCL 1.1 drivers.

My program works perfectly fine in VS2010 debug mode, or when ran
on its own from command line. I have fixed all the memory leaks
that VS found. Also all the thread return 0.

When executed in NVidia Visual Profiler I’m informed that my program has
encoutered a problem and needs to be closed. Extra information I am
given as follows:

ModName: nvcuda.dll
Offset: 0001de9b

The problem seems to be caused by events, buffers etc. getting destroyed after the context.

The event was the most peculiar one, as It was a local object in a function. I would assume
that would always get destroyed before the program halts, but it seems not. I was able to just
drop that event, so it’s not a big problem.

The problem are the buffers.
I use a singleton class which also serves as a factory for cl::Buffers. These buffers are
passed around as values or references to functions. It seems that sometimes (not always)
the context gets destroyed before the buffers, events and such do. This causes the program
to return no data whatsoever in visual profiler.

Do I need to implement my own reference counter wrapper for my buffers or has someone
found out a better way?

Juho Jokelainen