r/cpp • • Feb 16 '26

Favorite optimizations ??

I'd love to hear stories about people's best feats of optimization, or something small you are able to use often!

135 Upvotes

185 comments sorted by

View all comments

Show parent comment

3

u/DeadlyRedCube frequent compiler breaker 😬 Feb 17 '26

At one point (this was 20 years ago) just quitting a process would leak GDI handles on windows (despite that that shouldn't have been possible) and that bit me enough in a thing I was building that I'm paranoid about it now 😅

5

u/mredding Feb 17 '26

I think it was Win95/98 that such a termination would leave ports bound. There's all sorts of resources that used to be orphaned and unrecoverable, but that's mostly cleaned up now. OS X still has a problem with mutex handles.

1

u/DeadlyRedCube frequent compiler breaker 😬 Feb 17 '26

Yea that sounds right 😄

Also yikes, I didn't know about OSX mutex thing - I'll have to look into that one!