in reply to TCP Socket, Forking, Memory exhaustion

I was browsing through the Stein book as I was curious and it mentions a very high overhead for the object-oriented socket implementation. I am not sure if this is still true. On my Solaris machine one purely sleeping one thread consums about 1 MB memory.
  • Comment on Re: TCP Socket, Forking, Memory exhaustion

Replies are listed 'Best First'.
Re^2: TCP Socket, Forking, Memory exhaustion
by BrowserUk (Patriarch) on Nov 07, 2007 at 17:20 UTC

    It probable that the vast majority of that 1MB of memery per dormant thread is being consumed by an wildly over-generous per-thread stack allocation that will likely never be consumed. See Use more threads..

    I've had 3000 active threads running (not doing much; incrementing a counter and displaying it at a particular location on a 200x100 console session, but more than sleeping), all in under 1GB.

    Greedy in C terms, but not bad for 3000 independant interpreters.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.