Bug 45291 - apr_thread_t is leaking
Summary: apr_thread_t is leaking
Status: NEW
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: 1.3.0
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-26 14:39 UTC by Joe Mudd
Modified: 2008-12-15 09:49 UTC (History)
1 user (show)



Attachments
Proposed updates to 1.3 copy of win32/thread.c (2.02 KB, text/plain)
2008-06-26 14:39 UTC, Joe Mudd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Mudd 2008-06-26 14:39:05 UTC
Created attachment 22184 [details]
Proposed updates to 1.3 copy of win32/thread.c

I was trying to locate memory leaks while running an application on Windows and found that the apr_thread_t allocated w/in apr_thread_create() is never freed.

This leak is noticable when the process has lots of transient threads.  In my case the transient threads are managed by the thread pooling support in apr_thread_pool.c.

In a test copy I updated apr_thread_create() to allocate the apr_thread_t out of the pool created by apr_thread_create().  apr_thread_exit() and apr_thread_join() had to be updated as well.  I will attach a diff of the changes.

The updates assume that the thread creator will call either apr_thread_detach() followed by apr_thread_exit() or apr_thread_join() to clean up the thread.