jynx has asked for the wisdom of the Perl Monks concerning the following question:
When an object gets instantiated, does the entire object get bootstrapped into memory? Or just the data? Or maybe some subset of the two?
It doesn't make sense that when you load an object all of the methods that are coded to go with the object get loaded for every instance of the object, but this has been my long-standing belief since that's what seemed to be the case in C++ and Java (where an object is a collection of data and methods).
If this were the case than if i have 1000 objects instantiated on a system, there are 1000 duplicate 'new' methods running around somewhere (ok, almost but not quite duplicate). There would also be 1000 copies of every other method described for the object. Obviously this seems ineffecient and bulky, not to mention a couple other problems. i want a 1000 different data structures, but not the baggage.
First of all please tell me i'm wrong.
Second, what does get kept in memory? How does some of this fit together?
Please feel free to refer me to a written source, i'm just looking for clarification.
jynx
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: OO Baggage
by extremely (Priest) on Jan 16, 2001 at 03:43 UTC | |
Re: OO Baggage
by MeowChow (Vicar) on Jan 16, 2001 at 03:50 UTC | |
Re: OO Baggage
by Rudif (Hermit) on Jan 16, 2001 at 04:19 UTC | |
Re: OO Baggage
by lzcd (Pilgrim) on Jan 16, 2001 at 03:43 UTC | |
Re: OO Baggage
by Lexicon (Chaplain) on Jan 16, 2001 at 10:14 UTC | |
Re: OO Baggage
by coreolyn (Parson) on Jan 16, 2001 at 22:34 UTC |