What operating system do you use and how did you measure memory usage?
macosx 10.3(panther)/darwin 7.5.0; when I said "simple-minded", I meant it:
and while that was running, do "top" in another window; both processes showed up with the same size.perl -e '$|=1; @a=(0..10_000_000); $child = fork(); die "fork failed\n" unless (defined $child); print "parent = $$\nchild = $child\n" if $child; sleep 30'
I expect anything decent to share all of the pages, marking them Copy-on-Write.I guess I'd want to test different cases, with different amounts of data and a more realistic set of operations, to see whether I get what you expect. (I probably won't do that, actually -- it's not the sort of thing I need...)
As far as I understand Perl threads, every new interpreter copies everything not explicitly shared. I'd expect that to do even worse for the poster's question.Thanks for the clarification about threads. I'll grant that my experience with the concept of data sharing across processes is limited. (I'm sure I studied the C functions that create shared memory in Solaris years ago -- and I might even have used them a couple times...) As for threads, I might use them some day, and till then, I guess I should keep my mouth shut about them.
(update: ...um, if the OP happens to have 2GB organized into a few hefty data structures, and those are explicity shared, why would that be worse than forking? Are the methods for declaring what is shared really unpleasant, or something?)
In reply to Re^3: Handling multiple clients
by graff
in thread Handling multiple clients
by jalewis2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |