in reply to Re^2: "Auto" vivifying shared data structures
in thread "Auto" vivifying shared data structures

Very roughly speaking, a shared variable is implemented internally using a form of tieing. Each thread has its own copy of the tied variable, and the real value is stored in a separate area of shared memory. When you read a variable, the tied code gets called (XS rather than perl code), which locks the real shared value, then copies its value into the thread's private address space. Similary a write to a shared variable involves copying the private value into the shared variable. So in a worst-case scenario:
my $s : shared = 'a' x 10_000; for (1..100) { async { my $l = length $s; sleep } }
would consume about 1Mb, with each thread having a cached copy of the string at the point it was accessed.

Nested structures are more complicated than that, but roughly speaking the worst-case isn't as bad as the scalar case above.

Dave.