Faster Virtual Method Dispatch
Walter Bright
newshound at digitalmars.com
Wed Apr 26 20:26:56 PDT 2006
James Dunne wrote:
> Walter Bright wrote:
>> I.e. the problem crops up when the data in memory just doesn't fit
>> into a strictly heirarcical format.
> If you parent the memory you're creating in the tree data structures to
> a structure that is higher up the chain than both tree data structures,
> then the data doesn't get lost simply because you freed the data
> structure that held references to that memory.
I've designed data structures around the memory management requirement
for keeping a sole 'parent' around for it that can free it. But I'd
rather design data structures around how they are used instead.
For example, if I have an associative array of strings, I can stuff any
old string into it - even static strings - without having to worry about
who 'owns' those strings. It's quite liberating <g>.
More information about the Digitalmars-d
mailing list