Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/os/posix/perfMemory_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ static void unmap_shared(char* addr, size_t bytes) {
MemTracker::NmtVirtualMemoryLocker nvml;
res = ::munmap(addr, bytes);
if (res == 0) {
MemTracker::record_virtual_memory_release((address)addr, bytes);
MemTracker::record_virtual_memory_release(addr, bytes);
}
} else {
res = ::munmap(addr, bytes);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/windows/perfMemory_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,7 @@ void PerfMemory::detach(char* addr, size_t bytes) {
// it does not go through os api, the operation has to record from here
MemTracker::NmtVirtualMemoryLocker nvml;
remove_file_mapping(addr);
MemTracker::record_virtual_memory_release((address)addr, bytes);
MemTracker::record_virtual_memory_release(addr, bytes);
} else {
remove_file_mapping(addr);
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/nmt/memTracker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ class MemTracker : AllStatic {
}
}

static inline void record_virtual_memory_release(address addr, size_t size) {
static inline void record_virtual_memory_release(void* addr, size_t size) {
assert_post_init();
if (!enabled()) return;
if (addr != nullptr) {
VirtualMemoryTracker::remove_released_region((address)addr, size);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

That's correct as VMT does take address, whilst the external API takes "regular" pointers.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, looks weird. Are we planning on cleaning this up further up the chain then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not the plan, no. I believe that the address typedef is there to signify that we are concerned with storing addresses, but not dereferencing them.

}
}

static inline void record_virtual_memory_uncommit(address addr, size_t size) {
static inline void record_virtual_memory_uncommit(void* addr, size_t size) {
assert_post_init();
if (!enabled()) return;
if (addr != nullptr) {
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2204,7 +2204,7 @@ bool os::uncommit_memory(char* addr, size_t bytes, bool executable) {
MemTracker::NmtVirtualMemoryLocker nvml;
res = pd_uncommit_memory(addr, bytes, executable);
if (res) {
MemTracker::record_virtual_memory_uncommit((address)addr, bytes);
MemTracker::record_virtual_memory_uncommit(addr, bytes);
}
} else {
res = pd_uncommit_memory(addr, bytes, executable);
Expand All @@ -2226,7 +2226,7 @@ bool os::release_memory(char* addr, size_t bytes) {
MemTracker::NmtVirtualMemoryLocker nvml;
res = pd_release_memory(addr, bytes);
if (res) {
MemTracker::record_virtual_memory_release((address)addr, bytes);
MemTracker::record_virtual_memory_release(addr, bytes);
}
} else {
res = pd_release_memory(addr, bytes);
Expand Down Expand Up @@ -2311,7 +2311,7 @@ bool os::unmap_memory(char *addr, size_t bytes) {
MemTracker::NmtVirtualMemoryLocker nvml;
result = pd_unmap_memory(addr, bytes);
if (result) {
MemTracker::record_virtual_memory_release((address)addr, bytes);
MemTracker::record_virtual_memory_release(addr, bytes);
}
} else {
result = pd_unmap_memory(addr, bytes);
Expand Down Expand Up @@ -2350,7 +2350,7 @@ bool os::release_memory_special(char* addr, size_t bytes) {
MemTracker::NmtVirtualMemoryLocker nvml;
res = pd_release_memory_special(addr, bytes);
if (res) {
MemTracker::record_virtual_memory_release((address)addr, bytes);
MemTracker::record_virtual_memory_release(addr, bytes);
}
} else {
res = pd_release_memory_special(addr, bytes);
Expand Down