@@ -318,11 +318,11 @@ // entry which is either free or not yet committed. If not yet // committed, expand_at that index. uint curr = max_length() - 1; while (true) { HeapRegion *hr = _regions.get_by_index(curr); - if (hr == NULL) { + if (hr == NULL || !is_available(curr)) { uint res = expand_at(curr, 1, NULL); if (res == 1) { *expanded = true; return curr; }