The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Jango on March 12, 2012, 11:49:57 AM

Title: handle question
Post by: Jango on March 12, 2012, 11:49:57 AM
I have seen in lots of tutorial about closing the handle after making use of it and before closing the application.  Why it is necessary to close the handle?
Title: Re: handle question
Post by: hutch-- on March 12, 2012, 12:14:22 PM
It will tend to depend on what the handle is. Memory handles are usually de-allocated, in many cases window handles are automatically de-allocated. Tell us what you have in mind and we can probably help you to find the reference material.
Title: Re: handle question
Post by: dedndave on March 12, 2012, 01:45:12 PM
maybe this will help...
http://www.masm32.com/board/index.php?topic=17600.msg148139#msg148139
Title: Re: handle question
Post by: Tedd on March 12, 2012, 02:54:00 PM
Because it's good manners. :P
Title: Re: handle question
Post by: vanjast on March 13, 2012, 05:41:31 PM
If I remember correctly... a handle is actually a reference to a memory location, the use and size of this 'object' depends on its context.

Not closing the handle means you're not releasing memory and this will eventually cause a memory overrun/leak/crash.
:8)