On onsdag, juli 24, 2002, at 11:33 , Dave Mitchell wrote:

>
> On Wed, Jul 24, 2002 at 10:02:36PM +0200, Elizabeth Mattijsen wrote:
>> - using the ": shared" attribute is _not_ a way to save memory, quite 
>> the
>> contrary.  It uses even _more_ memory than unshared.  This seems
>> counter-intuitive to me and may be a bug.
>
> The main point of :shared is not to save memory, but to allow multiple
> threads access to the same data. From perlthrtut:
>
>     Also note that under the current implementation, shared variables 
> use
>     a little more memory and are a little slower than ordinary 
> variables.
>
> Each shared var has an emptyish SV per thread which has attached magic
> that allows it to access the contents of the real var.
>
> Dave.
>
> --
> "Emacs isn't a bad OS once you get used to it.
> It just lacks a decent editor."
>

For  a large amount of data :shared will save you memory, the overhead 
of the magic is rather small compared to large data structures :)

Arthur

Reply via email to