From: Giuliano Catrambone <giuliano.catrambone@catrasoftware.it>
To: pthreads-win32@sources.redhat.com
Subject: Memory leak with detached threads
Date: Sun, 29 Oct 2006 18:42:00 -0000 [thread overview]
Message-ID: <45450435.5080104@catrasoftware.it> (raw)
[-- Attachment #1: Type: text/plain, Size: 990 bytes --]
Hi all,
I found a memory leak working with detached threads.
I just made a simple C code to demonstrate where I have the memory leak.
Running the attached C code I saw about 4KB of memory leak every 20
iteration.
I'm using pthreads-dll-2005-03-08.
Could you tell me if I'm wronging something or if it is a bug?
Thanks in advance
giu
--
-----------------------------------------------------------------
Giuliano Catrambone
Director, Professional Services
Open source projects:
http://sourceforge.net/projects/catralibraries/
http://sourceforge.net/projects/openstreaming/
CatraSoftware:
Home page: http://www.catrasoftware.it
Streaming page:
http://www.catrasoftware.it/Streaming/CatraStreamingPlatform.htm
Mobile +39.393.8816655
Fixed: +39.02.90377228
Skype: Catrambone Giuliano
msn: giulianocatrambone@hotmail.com
Jabber: giuliano.catrambone@Jabber.org
Yahoo: giuliano.catrambone
-----------------------------------------------------------------
[-- Attachment #2: memoryLeak.cpp --]
[-- Type: text/x-c++src, Size: 855 bytes --]
#include <iostream>
#include <pthread.h>
#include <windows.h>
void *runFunction (void *pvPThread)
{
std:: cout << "Inside the thread" << std:: endl;
Sleep (300);
return (void *) NULL;
}
int main ()
{
pthread_t _pThread;
pthread_attr_t _pThreadAttribute;
for (long lIndex = 0; lIndex < 1000; lIndex++)
{
std:: cout << "Index: " << lIndex << std:: endl;
std:: cout << pthread_attr_init (&_pThreadAttribute) << std:: endl;
std:: cout << pthread_attr_setdetachstate (&_pThreadAttribute, PTHREAD_CREATE_DETACHED)
<< std:: endl;
std:: cout << pthread_create (&_pThread, &_pThreadAttribute, runFunction, NULL) << std:: endl;
// std:: cout << pthread_join (_pThread, &pvStatus) << std:: endl;
std:: cout << pthread_attr_destroy (&_pThreadAttribute) << std:: endl;
Sleep (300);
}
Sleep (1000 * 1000);
return 0;
}
next reply other threads:[~2006-10-29 18:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-29 18:42 Giuliano Catrambone [this message]
2006-10-29 20:20 ` Tim Theisen
2006-10-30 22:03 ` Giuliano Catrambone
2006-10-29 18:54 Stephen Croall
2006-10-29 19:02 Stephen Croall
2006-10-29 20:10 ` Giuliano Catrambone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45450435.5080104@catrasoftware.it \
--to=giuliano.catrambone@catrasoftware.it \
--cc=pthreads-win32@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).