Brent Phillips wrote:
> I've found that either there are some serious memory leaks in pTh, or I'm
> not using it properly. The most serious problem is that the stack space is
> not freed when a thread terminates. This quickly causes applications to run
> out of memory.

Are you remembering to pth_join() your terminated threads?

> To test this, I ran a few pth programs with a memory leak detector,
> ccmalloc (http://freshmeat.net/projects/ccmalloc). It turns up all sorts of
> memory leaks in pth- everything from the stack space to the attributes to
> the wait functions create memory leaks. (It is very simple to install and
> use.)
> 
> Please advise! Am I missing certain clean up functions? Or are these
> serious bugs in pTh?

In my experience I haven't encountered any real leaks.. although leaks
are easy to have if you aren't careful (sometimes this requires looking
at the source to see if/when a leak can happen).

For example, if you have a thread that can be cancelled, then any memory
you malloc() with that thread must be free'd by a shutdown hook.

> Pretty much any pTh program that spawns a thread should exhibit this
> behavior. I can supply sample code if necessary.

I'd be interested in seeing some code that demonstrates leaks.

-Archie

__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com
______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to