Skip to content
Draft
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/share/services/memoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ MemoryManager::MemoryManager(const char* name)
int MemoryManager::add_pool(MemoryPool* pool) {
int index = _num_pools;
assert(index < MemoryManager::max_num_pools, "_num_pools exceeds the max");
Copy link
Member

Choose a reason for hiding this comment

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

We need an assert on the lower bound as well

Copy link
Author

Choose a reason for hiding this comment

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

@swesonga what should the lower bound be? Should it be 1? Here is an example line that I could add:
assert(index >= 1, "_num_pools must be at least 1");

if (index < MemoryManager::max_num_pools) {
if (0 <= index && index < MemoryManager::max_num_pools) {
_pools[index] = pool;
_num_pools++;
}
Expand Down
Loading