PRB: GlobalAlloc() Pagelocks Blocks on Win32s (114611)
The information in this article applies to:
- Microsoft Win32s 1.3c
- Microsoft Win32s 1.1
- Microsoft Win32s 1.15
- Microsoft Win32s 1.2
- Microsoft Win32s 1.3
This article was previously published under Q114611 SYMPTOMS
If a Win32-based application running in Win32s uses GlobalAlloc() to
allocate memory from the global heap with GMEM_FIXED, with GPTR, with
GMEM_ZEROINIT, or without specifying GMEM_MOVEABLE the memory allocated
will be fixed and page-locked.
CAUSE
When a Win32 application running under Win32s on Windows 3.1 calls
GlobalAlloc() the call is translated via a thunk supplied by Win32s in a 16-
bit DLL. The 16-bit DLL then calls the Windows 3.1 function GlobalAlloc().
When GlobalAlloc() is called from a DLL in Windows 3.1 the allocated memory
will be fixed and page-locked unless GMEM_MOVEABLE is specified.
RESOLUTION
The GlobalAlloc() flags should always include GMEM_MOVEABLE if memory does
not need to be fixed and page-locked. This is expected behavior for Windows
3.1.
REFERENCES
Appendix B, titled "System Limits", of the "Win32s Programmer's Reference
Manual" briefly mentions on page 56 not to use GMEM_FIXED in GlobalAlloc()
called by 32-bit applications.
Modification Type: | Major | Last Reviewed: | 4/13/2004 |
---|
Keywords: | KB114611 |
---|
|