1.1 --- a/src/share/vm/memory/cardTableModRefBS.cpp Thu May 16 11:44:33 2013 +0100 1.2 +++ b/src/share/vm/memory/cardTableModRefBS.cpp Thu May 23 12:44:18 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -80,15 +80,11 @@ 1.11 1.12 _covered = new MemRegion[max_covered_regions]; 1.13 _committed = new MemRegion[max_covered_regions]; 1.14 - if (_covered == NULL || _committed == NULL) 1.15 + if (_covered == NULL || _committed == NULL) { 1.16 vm_exit_during_initialization("couldn't alloc card table covered region set."); 1.17 - int i; 1.18 - for (i = 0; i < max_covered_regions; i++) { 1.19 - _covered[i].set_word_size(0); 1.20 - _committed[i].set_word_size(0); 1.21 } 1.22 + 1.23 _cur_covered_regions = 0; 1.24 - 1.25 const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 : 1.26 MAX2(_page_size, (size_t) os::vm_allocation_granularity()); 1.27 ReservedSpace heap_rs(_byte_map_size, rs_align, false); 1.28 @@ -134,7 +130,7 @@ 1.29 || _lowest_non_clean_base_chunk_index == NULL 1.30 || _last_LNC_resizing_collection == NULL) 1.31 vm_exit_during_initialization("couldn't allocate an LNC array."); 1.32 - for (i = 0; i < max_covered_regions; i++) { 1.33 + for (int i = 0; i < max_covered_regions; i++) { 1.34 _lowest_non_clean[i] = NULL; 1.35 _lowest_non_clean_chunk_size[i] = 0; 1.36 _last_LNC_resizing_collection[i] = -1; 1.37 @@ -153,6 +149,33 @@ 1.38 } 1.39 } 1.40 1.41 +CardTableModRefBS::~CardTableModRefBS() { 1.42 + if (_covered) { 1.43 + delete[] _covered; 1.44 + _covered = NULL; 1.45 + } 1.46 + if (_committed) { 1.47 + delete[] _committed; 1.48 + _committed = NULL; 1.49 + } 1.50 + if (_lowest_non_clean) { 1.51 + FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC); 1.52 + _lowest_non_clean = NULL; 1.53 + } 1.54 + if (_lowest_non_clean_chunk_size) { 1.55 + FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC); 1.56 + _lowest_non_clean_chunk_size = NULL; 1.57 + } 1.58 + if (_lowest_non_clean_base_chunk_index) { 1.59 + FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC); 1.60 + _lowest_non_clean_base_chunk_index = NULL; 1.61 + } 1.62 + if (_last_LNC_resizing_collection) { 1.63 + FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC); 1.64 + _last_LNC_resizing_collection = NULL; 1.65 + } 1.66 +} 1.67 + 1.68 int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) { 1.69 int i; 1.70 for (i = 0; i < _cur_covered_regions; i++) {