Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class Questions
Message
From
24/01/1999 16:12:50
 
 
To
24/01/1999 06:01:43
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00177951
Message ID:
00179620
Views:
28
>>Dragan,
>>
>>>In this example you have only one property, which is different in any subclass of the initial class. The whole chain is loaded, and all the definitions are here. What I'm supposing, is that if there was some Prop2, which was redefined only at B and D level, and overrriden in the object itself, wouldn't use any space in C level, and if it wasn't redefined in object x, wouldn't have space allocated in that object either. Is there a way to measure this?
>>
>>If any of those levels had not overridden the property you'd see it's value as that of it's ParentClass. I'm not sure you can accurately detect the property space consumed by the class definition, we don't really have good measurement tools, other than sys(1016) which isn't too accurate.
>
>Yup. That's why we're just stabbing the dark. I just thought of creating a custom class which would have some huge property, something to keep half a meg of something, and to instantiate two or three objects out of it... so if we have a tool which is not precise, we may have to give it couple of huge things to measure.
>
>Here's the example of what I mean:
>
>
>? "********** start"
>?sys(1016)
>x1=createobj("alloc")
>? "createobj"
>?sys(1016)
>x2=createobj("alloc")
>? " another createobj"
>?sys(1016)
>x3=createobj("alloc")
>? " yet another createobj"
>?sys(1016)
>x1.placeholder=stuff(x1.placeholder,23,45,repl("x",45))
>? "nondefault property"
>?sys(1016)
>rele x1
>?"Released"
>?sys(1016)
>
>define class alloc as custom
>	placeholder=space(100000)
>enddef
>
>
>When I ran this, it took something like 100000 bytes when the object was instantiated, and another 100000 when the property changed, and returned only 100000 when the object was released (but the class definition remained in memory).
>
>Then I've modified the routine to create two more objects, and it took only 666 extra bytes for the other object, then only 560 for the third.
>
>Did I prove my point?

I agree with David, you may be on to something there. It would be very interesting to see exactly how an object is layed out in memory.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform