--- old/src/hotspot/os/aix/os_perf_aix.cpp 2018-07-10 15:42:50.093986989 -0400 +++ new/src/hotspot/os/aix/os_perf_aix.cpp 2018-07-10 15:42:49.873974870 -0400 @@ -893,21 +893,14 @@ } int SystemProcessInterface::SystemProcesses::ProcessIterator::next_process() { - struct dirent* entry; - if (!is_valid()) { return OS_ERR; } do { - entry = os::readdir(_dir, _entry); - if (entry == NULL) { - // error - _valid = false; - return OS_ERR; - } + _entry = os::readdir(_dir); if (_entry == NULL) { - // reached end + // Error or reached end. Could use errno to distinguish those cases. _valid = false; return OS_ERR; } @@ -929,11 +922,8 @@ } SystemProcessInterface::SystemProcesses::ProcessIterator::~ProcessIterator() { - if (_entry != NULL) { - FREE_C_HEAP_ARRAY(char, _entry); - } if (_dir != NULL) { - closedir(_dir); + os::closedir(_dir); } }