What happens if I do not call RegCloseKey the public key?

On Windows, what happens to the HKEY public variable if you don't call RegCloseKey before the HKEY goes out of scope? I do not see any errors or warnings or memory leaks when closing the application. MSDN does not offer much help , but it sounds like it is using resources in some way. Does anyone know what is really going on?

+4
source share
1 answer

You are an orphan descriptor, which is a limited (okay, that's a pretty big limit) resource. However, as soon as your application terminates, the handle is eventually freed by the OS, so the lost resource will eventually be returned to the pool.

It is a bad programming practice, however, to highlight what has limitations and not release it when you are done with it.

+5
source

All Articles