Changeset 95804 in vbox
- Timestamp:
- Jul 25, 2022 12:29:26 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 152526
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/alloc-win.cpp
r93115 r95804 29 29 * Header Files * 30 30 *********************************************************************************************************************************/ 31 /*#define USE_VIRTUAL_ALLOC*/ 31 #ifdef IPRT_NO_CRT 32 # define USE_VIRTUAL_ALLOC 33 #endif 32 34 #define LOG_GROUP RTLOGGROUP_MEM 33 35 #include <iprt/win/windows.h> … … 52 54 */ 53 55 AssertMsg(cb, ("Allocating ZERO bytes is really not a good idea! Good luck with the next assertion!\n")); 56 #ifdef USE_VIRTUAL_ALLOC 57 cb = RT_ALIGN_Z(cb, PAGE_SIZE); 58 void *pv = VirtualAlloc(NULL, cb, MEM_COMMIT, PAGE_EXECUTE_READWRITE); 59 AssertMsg(pv, ("VirtualAlloc(%zx) failed!!!\n", cb)); 60 #else 54 61 cb = RT_ALIGN_Z(cb, 32); 55 62 void *pv = malloc(cb); … … 69 76 } 70 77 } 78 #endif 71 79 return pv; 72 80 } … … 78 86 79 87 if (pv) 88 #ifdef USE_VIRTUAL_ALLOC 89 if (!VirtualFree(pv, 0, MEM_RELEASE)) 90 AssertMsgFailed(("pv=%p lasterr=%d\n", pv, GetLastError())); 91 #else 80 92 free(pv); 93 #endif 81 94 } 82 95
Note:
See TracChangeset
for help on using the changeset viewer.