More on Releasing Objects in UMDF

Hi,

In the UMDF Fx2 samples, I see that CMyReadWriteQueue is created with CreateInstance that uses the “new” operator.
As I understand only one reference remains valid during execution, which is the one from CreateInstance. All other references are released immediately after usage, so only the one pending reference from CreateInstance prevents the queue object from being deleted.
No one calls the queue destructor directly, and no one releases this one pending reference explicitly.
So, the question is, when is this object being released?
I’m asking this because I’ve added more queues which I want to remove at OnCleanupFile and not when the whole device is being released.
I’ve added a CMyQueue object.
Should I release both the CMyQueue object and the IWDFIoQueue which is inside it (to release its data member m_FxQueue explicitly)?
Or only one of them?

Thanks,
Gadi