How to know if unmanaged object is not in memory?
-
Problem Statement: How to know if unmanaged com object is deleted from memory. Problem Description: I have unmanaged object instance in one class. When closing application this object is is destructed from other part of code. And it also comes to point where object is member of class to do some final clear stuff. When it tried to access this com object (which has already been deleted from memory) it throws memory access violation error. Is there any way to know if this object still exist? Thanks, AksharRoop
-
Problem Statement: How to know if unmanaged com object is deleted from memory. Problem Description: I have unmanaged object instance in one class. When closing application this object is is destructed from other part of code. And it also comes to point where object is member of class to do some final clear stuff. When it tried to access this com object (which has already been deleted from memory) it throws memory access violation error. Is there any way to know if this object still exist? Thanks, AksharRoop
Check if it is null?
-
Check if it is null?
I hope I atleast know this!! The object is not null. It holds a pointer to an object. so here it is a 'dangling ptr' kind of situation.
-
I hope I atleast know this!! The object is not null. It holds a pointer to an object. so here it is a 'dangling ptr' kind of situation.
Not so much "dangling pointer", but orphaned. The only way to see if it still exists is to check the pointer to it for null. If you're worried about orphaning pointers, make sure you're those pointers to other objects are null before you kill the parent object.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
Not so much "dangling pointer", but orphaned. The only way to see if it still exists is to check the pointer to it for null. If you're worried about orphaning pointers, make sure you're those pointers to other objects are null before you kill the parent object.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...Thanks Dave, I wrote a similar reply but just happened to see that there was another comment :D