in reply to Re: Multithreaded memory usage
in thread Multithreaded memory usage

Ok, I'll try that. I am assuming once a detached thread reaches the end of its code block it should automatically quit and the OS should recover that memory? (assuming it is coded correctly :-) )

Cheers

Replies are listed 'Best First'.
Re^3: Multithreaded memory usage
by moritz (Cardinal) on Apr 21, 2009 at 08:26 UTC
    I am assuming once a detached thread reaches the end of its code block it should automatically quit and the OS should recover that memory?

    I'm really not an expert here, but I don't think that's the case, at least not always. The OS probably doesn't have any idea about which parts of the memory is associated to which user-level thread, and thus can't clean up. It does know about processes though, which is why I recommended them over threads.

      I'm a little confused here. I'm currently using the $thread->create() method. Isn't that already spawning a new thread? Would a new process be something like using backticks to execute another Perl script?

      Cheers

      P.S did you go to St Andrews to do Physics at all?

        Would a new process be something like using backticks to execute another Perl script?

        Or calling fork, or the pipe form of open, yes.

        P.S did you go to St Andrews to do Physics at all?

        (assuming that you are referring to my home node picture) Actually I went to Edinburgh (Heriot Watt University) to do Physics, and I did my Master there - but I also did some excursions, for example to the Isle of Skye, where I took that picture on the way.

        Let's say that the curses where not as demanding as I was expecting...