wxThread problems

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
jgarden
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Apr 04, 2007 3:19 pm

wxThread problems

Post by jgarden » Wed Apr 04, 2007 3:24 pm

Just upgraded from 2.6.3 to 2.8.2.

We used to have problems with wxThread not cleaning up properly, but they went away in 2.6.3. Now they are back.

Are there any known issues with deleting wxThreads. I'm seeing memory leaks.

lowjoel
Moderator
Moderator
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel » Wed Apr 04, 2007 9:59 pm

Apart from you needing to use wxThread::Delete instead of delete thread; it should be alright.

What leak detector are you using?

Joel

jgarden
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Apr 04, 2007 3:19 pm

Post by jgarden » Mon Apr 09, 2007 1:08 pm

lowjoel wrote:Apart from you needing to use wxThread::Delete instead of delete thread; it should be alright.
I am calling Delete(), but my destructors are not getting called.
What leak detector are you using?
Nothing fancy - I'm getting a dump in the Visual Studio Output on exit. I have 'new' redefined to give me file name and line numbers.

As I mentioned in my original post, this is behaviour that went away in 2.6.3, and reappeared in 2.8.2, in code that has not changed (I know, that's what they all say). So it could be my fault, but it's strange that it would disappear and reappear like that.

I'm more worried about the possibility that the thread is not terminating properly than about the memory leak, because the app creates and deletes lots of threads, not necessarily just at startup/exit.

lowjoel
Moderator
Moderator
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel » Mon Apr 09, 2007 2:11 pm

Are you certain that your destructors are not being called? The VS leak detector has (erroneously) reported leaks in my applications before.

Joel

jgarden
In need of some credit
In need of some credit
Posts: 7
Joined: Wed Apr 04, 2007 3:19 pm

Post by jgarden » Mon Apr 09, 2007 3:53 pm

lowjoel wrote:Are you certain that your destructors are not being called? The VS leak detector has (erroneously) reported leaks in my applications before.
I could be convinced that the leak detector is lying, but not both it and the debugger.

With 2.6.3, if I set a breakpoint in the destructor I hit it. With 2.8.2, I don't.

JG

Post Reply