Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/sparsePRT.hpp @ 1045:fa2f65ebeb08
6870843: G1: G1 GC memory leak
Summary: The fix addresses two memory leaks in G1 code: (1) _evac_failure_scan_stack - a resource object allocated on the C heap was not freed; (2) RSHashTable were linked into deleted list which was only cleared at full GC.
Reviewed-by: tonyp, iveresov
author | apetrusenko |
---|---|
date | Tue, 27 Oct 2009 02:42:24 -0700 |
parents | 2c79770d1f6e |
children | 0414c1049f15 |
comparison
equal
deleted
inserted
replaced
1044:6270f80a7331 | 1045:fa2f65ebeb08 |
---|---|
100 SparsePRTEntry* _entries; | 100 SparsePRTEntry* _entries; |
101 int* _buckets; | 101 int* _buckets; |
102 int _free_region; | 102 int _free_region; |
103 int _free_list; | 103 int _free_list; |
104 | 104 |
105 static RSHashTable* _head_deleted_list; | |
106 RSHashTable* _next_deleted; | |
107 RSHashTable* next_deleted() { return _next_deleted; } | |
108 void set_next_deleted(RSHashTable* rsht) { _next_deleted = rsht; } | |
109 bool _deleted; | |
110 void set_deleted(bool b) { _deleted = b; } | |
111 | |
112 // Requires that the caller hold a lock preventing parallel modifying | 105 // Requires that the caller hold a lock preventing parallel modifying |
113 // operations, and that the the table be less than completely full. If | 106 // operations, and that the the table be less than completely full. If |
114 // an entry for "region_ind" is already in the table, finds it and | 107 // an entry for "region_ind" is already in the table, finds it and |
115 // returns its address; otherwise returns "NULL." | 108 // returns its address; otherwise returns "NULL." |
116 SparsePRTEntry* entry_for_region_ind(RegionIdx_t region_ind) const; | 109 SparsePRTEntry* entry_for_region_ind(RegionIdx_t region_ind) const; |
152 size_t capacity() const { return _capacity; } | 145 size_t capacity() const { return _capacity; } |
153 size_t capacity_mask() const { return _capacity_mask; } | 146 size_t capacity_mask() const { return _capacity_mask; } |
154 size_t occupied_entries() const { return _occupied_entries; } | 147 size_t occupied_entries() const { return _occupied_entries; } |
155 size_t occupied_cards() const { return _occupied_cards; } | 148 size_t occupied_cards() const { return _occupied_cards; } |
156 size_t mem_size() const; | 149 size_t mem_size() const; |
157 bool deleted() { return _deleted; } | |
158 | 150 |
159 SparsePRTEntry* entry(int i) const { return &_entries[i]; } | 151 SparsePRTEntry* entry(int i) const { return &_entries[i]; } |
160 | 152 |
161 void print(); | 153 void print(); |
162 | |
163 static void add_to_deleted_list(RSHashTable* rsht); | |
164 static RSHashTable* get_from_deleted_list(); | |
165 }; | 154 }; |
166 | 155 |
167 // ValueObj because will be embedded in HRRS iterator. | 156 // ValueObj because will be embedded in HRRS iterator. |
168 class RSHashTableIter VALUE_OBJ_CLASS_SPEC { | 157 class RSHashTableIter VALUE_OBJ_CLASS_SPEC { |
169 int _tbl_ind; // [-1, 0.._rsht->_capacity) | 158 int _tbl_ind; // [-1, 0.._rsht->_capacity) |