Elizabeth Mattijsen wrote:
> 
> At 09:18 AM 7/25/02 +0200, Arthur Bergman wrote:
> >>Each shared var has an emptyish SV per thread which has attached
> >>magic that allows it to access the contents of the real var.
> >For a large amount of data :shared will save you memory, the overhead
> >of the magic is rather small compared to large data structures :)
> 
> Eh... that's what you might think, but my observations (I wouldn't
> call them benchmarks) tell me otherwise...  ;-(

When the interpreter is cloned, does the *data* in a shared variable get
copied?  If so, then clearly that's you're problem right there.

The shared variable would, in the new thread, have a complete copy of
the data that was in the original variable, plus a bit of magic which
says to ignore that copy, but use the data in the original.  The copied
data would be unused and and the memory wasted.

I'm not sure how to check for this being the case, though.

-- 
tr/`4/ /d, print "@{[map --$| ? ucfirst lc : lc, split]},\n" for
pack 'u', pack 'H*', 'ab5cf4021bafd28972030972b00a218eb9720000';

Reply via email to