Boundschecker reporting a leak

I just got a copy of Boundschecker and it’s reporting a small leak on a simple command line program. It’s not a memory leak, but what Boundschecker classifies as a resource leak.

I just grabbed the latest from svn (18-nov about 1:45p).

The resource that’s leaking is sleepEvent from juce_win32_Threads.cpp. I think we need a CloseHandle(sleepEvent) somewhere, or perhaps use the WaitableEvent class…

Maybe shutdown equivalents of juce_initialiseThreadEvents and SystemStats::initialiseStats that get called from shutdownJuce_NonGUI?

The relevant parts of my code are:

int main ( int argc, char *argv )
do something */
return 0;

BoundsChecker is unhappy about lots of other stuff but this seems like a simple one. I’m going through the hello example now so I may have more to ask about.

Are you in general interested in cleaning up stuff like this even though the OS likely deals with it when programs shut down?

Thanks for your help.


That’s just a single object that gets used while the app’s running. Didn’t really even seem worth the trouble to delete it, TBH, so it’s deliberately leaked. I guess I could add shutdown code to clean it up, but it’s really not important.

I thought handles were automatically closed by Windows when the application closes.

Yeah, the handles do get cleaned up. I agree it’s not so important, but trying to figure out which warnings are real and which ones aren’t is enough work that removing warnings where we can seems like a good idea.

There are lots more when I move to the hello world app. I’ll see if I can dive in enough to see if there’s anything legit there.


Thanks - I’d be keen to have a look through anything it’s coming up with.