summaryrefslogtreecommitdiff
path: root/sal/rtl/source/alloc_arena.c
diff options
context:
space:
mode:
Diffstat (limited to 'sal/rtl/source/alloc_arena.c')
-rw-r--r--sal/rtl/source/alloc_arena.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c
index 790220d5691d..571926c385b2 100644
--- a/sal/rtl/source/alloc_arena.c
+++ b/sal/rtl/source/alloc_arena.c
@@ -1212,16 +1212,9 @@ SAL_CALL rtl_machdep_alloc (
#elif defined(SAL_W32)
addr = VirtualAlloc (NULL, (SIZE_T)(size), MEM_COMMIT, PAGE_READWRITE);
#elif defined(SAL_OS2)
- {
- APIRET rc;
- addr = 0;
- // Use DosAlloc* to get a 4KB page aligned address.
- rc = DosAllocMem( &addr, size, PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_ANY);
- if (rc) {
- fprintf( stderr, "sal3::DosAllocMem failed rc=%d\n", rc);
- addr = 0;
- }
- }
+ /* Use valloc() to use libc 16MB chunks when allocating high memory, to reduce
+ virtual address fragmentation. */
+ addr = valloc( size);
#endif /* (SAL_UNX || SAL_W32 || SAL_OS2) */
if (addr != MAP_FAILED)
@@ -1256,7 +1249,7 @@ SAL_CALL rtl_machdep_free (
#elif defined(SAL_W32)
(void) VirtualFree ((LPVOID)(pAddr), (SIZE_T)(0), MEM_RELEASE);
#elif defined(SAL_OS2)
- (void) DosFreeMem( pAddr);
+ free(pAddr);
#endif /* (SAL_UNX || SAL_W32) */
}