I should have said:
I can imagine you can calculate the required bytes

That is if you've got a simple object and some insight on how objects are stored in memory.
But forget about this remark, I hope we don't have to go down this road all the way.
The crash with
Mem_Copy oTemp, lPtr, 4 when checking afterwards is still some secret to me. (though I might have an idea where it comes from, but I might be wrong so I will put this aside for the moment, furthermore it's not important in the moment).
Of course I tried your example with the Class (ever since I trip over your "p
ionterToSomething" - I should have corrected it but I didn't). What I did change, was "name as string" to "strname as string" - you know why!
And, yes, I'm familiar as to the results showing.
But let's few our new "tool" - we still facing at least two problems:
1. An ordinary object requires only 4 bytes in memory. If I'm not mistaken, every set object to an object that already exists (without using the keyword "New") only is a number in the range of "As Long". But see the example it makes it clear:
Code:
Private Const coBytes As Long = 4
Sub PointsToAnotherObject()
Dim objwks As Worksheet
Debug.Print
Debug.Print ObjPtr(Sheet1)
pionterToSomething "Sheet1 ", ObjPtr(Sheet1), coBytes
Set objwks = Sheet1
Debug.Print ObjPtr(objwks)
pionterToSomething "objwks ", ObjPtr(objwks), coBytes
End Sub
So in case you store
ObjPtr(objwks) in a variable and check afterwards you might think the referencecount didn't work, because it's still there (unless you remove Sheet1 from your workbook). So there won't be any hint whether or not the 4 Bytes are freed, because afterwards you always will find the object of origin.
2. If memory is freed, we might find "cleared to zero", but there might be something else assigned to the pointer. Up to now it only occured when testing with pointers to a Long-variable, but I think it always can happen. Therefore we better compare - keeping in mind point 1
Just got the message of your new post, I will have a look at it now. But I anyway wanted to say, circular reference in classes - I don't know if you can free memory at all - without closing excel.