Another possible reason could be 2 globals or statics dependent on each other interfereing with their destruction while the program shutdown. It goes down to the problem egawtry. What if you run the program in debug mode and let it exit and see what cause the issue? Or put in some intelligent logging in the functions mentioned in the trace output.