Mercurial > hg > graal-jvmci-8
comparison src/share/vm/services/memSnapshot.cpp @ 10221:c18152e0554e
8013120: NMT: Kitchensink crashes with assert(next_region == NULL || !next_region->is_committed_region()) failed: Sanity check
Summary: Fixed NMT to deal with releasing virtual memory region when there are still committed regions within it
Reviewed-by: acorn, coleenp
author | zgu |
---|---|
date | Mon, 06 May 2013 11:15:13 -0400 |
parents | fc64254f5579 |
children | 78bbf4d43a14 |
comparison
equal
deleted
inserted
replaced
10219:9c8e2f44228d | 10221:c18152e0554e |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
260 assert(rec->is_deallocation_record(), "Sanity check"); | 260 assert(rec->is_deallocation_record(), "Sanity check"); |
261 VMMemRegion* cur = (VMMemRegion*)current(); | 261 VMMemRegion* cur = (VMMemRegion*)current(); |
262 assert(cur->is_reserved_region() && cur->contains_region(rec), | 262 assert(cur->is_reserved_region() && cur->contains_region(rec), |
263 "Sanity check"); | 263 "Sanity check"); |
264 if (rec->is_same_region(cur)) { | 264 if (rec->is_same_region(cur)) { |
265 // release whole reserved region | 265 |
266 // In snapshot, the virtual memory records are sorted in following orders: | |
267 // 1. virtual memory's base address | |
268 // 2. virtual memory reservation record, followed by commit records within this reservation. | |
269 // The commit records are also in base address order. | |
270 // When a reserved region is released, we want to remove the reservation record and all | |
271 // commit records following it. | |
266 #ifdef ASSERT | 272 #ifdef ASSERT |
267 VMMemRegion* next_region = (VMMemRegion*)peek_next(); | 273 address low_addr = cur->addr(); |
268 // should not have any committed memory in this reserved region | 274 address high_addr = low_addr + cur->size(); |
269 assert(next_region == NULL || !next_region->is_committed_region(), "Sanity check"); | |
270 #endif | 275 #endif |
276 // remove virtual memory reservation record | |
271 remove(); | 277 remove(); |
278 // remove committed regions within above reservation | |
279 VMMemRegion* next_region = (VMMemRegion*)current(); | |
280 while (next_region != NULL && next_region->is_committed_region()) { | |
281 assert(next_region->addr() >= low_addr && | |
282 next_region->addr() + next_region->size() <= high_addr, | |
283 "Range check"); | |
284 remove(); | |
285 next_region = (VMMemRegion*)current(); | |
286 } | |
272 } else if (rec->addr() == cur->addr() || | 287 } else if (rec->addr() == cur->addr() || |
273 rec->addr() + rec->size() == cur->addr() + cur->size()) { | 288 rec->addr() + rec->size() == cur->addr() + cur->size()) { |
274 // released region is at either end of this region | 289 // released region is at either end of this region |
275 cur->exclude_region(rec->addr(), rec->size()); | 290 cur->exclude_region(rec->addr(), rec->size()); |
276 assert(check_reserved_region(), "Integrity check"); | 291 assert(check_reserved_region(), "Integrity check"); |