Re: Threads Memory Leak (Urgent)

[email protected] (Steve Schein)
Newsgroups perl.ithreads
Message-ID <1091468260.2765.17.camel@Development>
<snip>


> I have found that at the end of each thread memory was not released by
> the thread and after some runs the computer was not having sufficient
> memory and stopped.
> 

>>> Aashish - If you could post some pertinent code, the fine and
talented individuals in this forum could be more helpful to you. 
Personally, I have run into this situation before.  While there are
several potential reasons why memory is not getting released I would
suggest the following as it relates to Perl ithreads:

1) Minimize the amount of newly launched threads other than those that
are established at run-time.  If possible try to have threads stay open
for reuse and perform tasks in response to messages that are inserted
via message queues, sockets, etc.  Take a look at Liz's Thread::Pool if
you need to have lots of threads perform similar tasks.

2) Be extremely careful with shared memory and how variables get
declared.  Educate yourself on what happens each time a new thread gets
launched and think about how that might impact the use and eventual
release of memory.

I have learned a great deal about ithreads on this forum but I truly
became successful with them after I learned a bit about proper
multi-threaded application techniques.

Cheers,

Steve
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.