908 // but ignore other failures
909 result = ::close(fd);
910 assert(result != OS_ERR, "could not close file");
911
912 if (mapAddress == MAP_FAILED) {
913 if (PrintMiscellaneous && Verbose) {
914 warning("mmap failed: %s\n", strerror(errno));
915 }
916 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(),
917 "Could not map PerfMemory");
918 }
919
920 // it does not go through os api, the operation has to record from here
921 MemTracker::record_virtual_memory_reserve((address)mapAddress, size, mtInternal, CURRENT_PC);
922
923 *addr = mapAddress;
924 *sizep = size;
925
926 if (PerfTraceMemOps) {
927 tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
928 INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
929 }
930 }
931
932
933
934
935 // create the PerfData memory region
936 //
937 // This method creates the memory region used to store performance
938 // data for the JVM. The memory may be created in standard or
939 // shared memory.
940 //
941 void PerfMemory::create_memory_region(size_t size) {
942
943 if (PerfDisableSharedMem) {
944 // do not share the memory for the performance data.
945 _start = create_standard_memory(size);
946 }
947 else {
948 _start = create_shared_memory(size);
|
908 // but ignore other failures
909 result = ::close(fd);
910 assert(result != OS_ERR, "could not close file");
911
912 if (mapAddress == MAP_FAILED) {
913 if (PrintMiscellaneous && Verbose) {
914 warning("mmap failed: %s\n", strerror(errno));
915 }
916 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(),
917 "Could not map PerfMemory");
918 }
919
920 // it does not go through os api, the operation has to record from here
921 MemTracker::record_virtual_memory_reserve((address)mapAddress, size, mtInternal, CURRENT_PC);
922
923 *addr = mapAddress;
924 *sizep = size;
925
926 if (PerfTraceMemOps) {
927 tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
928 INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
929 }
930 }
931
932
933
934
935 // create the PerfData memory region
936 //
937 // This method creates the memory region used to store performance
938 // data for the JVM. The memory may be created in standard or
939 // shared memory.
940 //
941 void PerfMemory::create_memory_region(size_t size) {
942
943 if (PerfDisableSharedMem) {
944 // do not share the memory for the performance data.
945 _start = create_standard_memory(size);
946 }
947 else {
948 _start = create_shared_memory(size);
|