![]() |
#22
|
|||
|
|||
![]()
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 "pionterToSomething" - 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 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. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wierd "script code" in a downloaded .doc file | CNBarnes | Word | 2 | 10-18-2012 02:07 AM |
![]() |
krishnaoptif | Word VBA | 9 | 06-22-2012 05:08 AM |
![]() |
Jamal NUMAN | Word | 2 | 07-03-2011 03:11 AM |
Rules and Alerts: "run a script"? | discountvc | Outlook | 0 | 06-15-2010 07:36 AM |
An "error has occurred in the script on this page" | decann | Outlook | 8 | 09-03-2009 08:54 AM |