memset & 'VirtualQuery'

Christopher Faylor
Fri Jun 3 20:19:00 GMT 2005

On Fri, Jun 03, 2005 at 09:35:35PM +0200, Christophe Jaillet wrote:
>[sorry for the wrong post in cygwin-patches...]
>when looking thrue cygwin code looking for function 'VirtualQuery', we can
>see that it is passed a structure (MEMORY_BASIC_INFORMATION).
>In some cases, this structure is memset'ed to 0 before the call, sometimes,
>My very own opinion about it, is that there is no need to reset the content
>of the structure before the call and in some places a call to memset can be
>Here is a list of the call to 'VirtualQuery' which uses memset and could be
>optimised :
>   - (terminate_thread)
>   - (stack_base)
>   - (interruptible)
>All the other calls to 'VirtualQuery' don't use memset.
>If you think it is useful, I can provide a patch for this in the next few

All of the calls to VirtualQuery which first clear the
MEMORY_BASIC_INFORMATION structure do so for a reason -- it simplifies
subsequent inspection of that structure if you are assured that it is
all zero.


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list