< prev index next >
src/os/posix/vm/os_posix.cpp
Print this page
@@ -134,10 +134,25 @@
void os::wait_for_keypress_at_exit(void) {
// don't do anything on posix platforms
return;
}
+// Reserve memory by creating a temporary file in the provided directory and using it for mmap() call
+// This function is only relevant to Linux. Report failure when called for other OSes
+char* os::reserve_memory_with_backing_file(size_t bytes, char* requested_addr, size_t alignment_hint, const char* backingFileDir) {
+#ifdef TARGET_OS_FAMILY_linux
+ char* result = os::Linux::reserve_memory_with_backing_file(bytes, requested_addr, alignment_hint, backingFileDir);
+ if (result != NULL) {
+ MemTracker::record_virtual_memory_reserve((address)result, bytes, CALLER_PC);
+ }
+ return result;
+#else
+ VMError::report_and_die("Allocating object heap with backing file is not supported for this OS");
+ return NULL;
+#endif
+}
+
// Multiple threads can race in this code, and can remap over each other with MAP_FIXED,
// so on posix, unmap the section at the start and at the end of the chunk that we mapped
// rather than unmapping and remapping the whole chunk to get requested alignment.
char* os::reserve_memory_aligned(size_t size, size_t alignment) {
assert((alignment & (os::vm_allocation_granularity() - 1)) == 0,
< prev index next >