|
From: <kei...@te...> - 2006-09-04 09:42:55
|
guys,
Thanks. I got it.
keishi=20
-----Original Message-----
From: val...@li... =
[mailto:val...@li...] On Behalf Of =
Christoph Bartoschek
Sent: Monday, September 04, 2006 4:43 PM
To: val...@li...
Subject: Re: [Valgrind-users] memory leak in pthread?
> Could you tell me what the bug is?
> I cannot think of anything wrong with my code.
> "gcc -g -o test_thread test_thread.c -Wall -lpthrad" doesn't
> show any warnings.
Your code is:
int main()
{
int tid;
if (0 =3D=3D pthread_create((pthread_t *)tid, NULL, thread1, 0))
pthread_join(tid, 0);
return 0;
}
You cast an int to a pointer and pass it to pthread_create. =
pthread_create=20
tries to dereference the pointer and writes the thread id into the =
location.=20
But the pointer you have given is a random uninitialized integer.=20
Most of the time this should lead to a SIGSEGV.
Christoph
-------------------------------------------------------------------------=
Using Tomcat but need to do more? Need to support web services, =
security?
Get stuff done quickly with pre-integrated technology to make your job =
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache =
Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D=
121642
_______________________________________________
Valgrind-users mailing list
Val...@li...
https://lists.sourceforge.net/lists/listinfo/valgrind-users
|