comparison src/share/vm/utilities/numberSeq.cpp @ 5938:2c0751569716

7152954: G1: Native memory leak during full GCs Summary: Add destructor to TruncatedSeq and call delete when necessary Reviewed-by: johnc, tonyp
author brutisso
date Tue, 13 Mar 2012 21:12:53 +0100
parents f95d63e2154a
children bbc900c2482a
comparison
equal deleted inserted replaced
5937:cf956638b844 5938:2c0751569716
1 /* 1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2012, 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.
154 _sequence = NEW_C_HEAP_ARRAY(double, _length); 154 _sequence = NEW_C_HEAP_ARRAY(double, _length);
155 for (int i = 0; i < _length; ++i) 155 for (int i = 0; i < _length; ++i)
156 _sequence[i] = 0.0; 156 _sequence[i] = 0.0;
157 } 157 }
158 158
159 TruncatedSeq::~TruncatedSeq() {
160 FREE_C_HEAP_ARRAY(double, _sequence);
161 }
162
159 void TruncatedSeq::add(double val) { 163 void TruncatedSeq::add(double val) {
160 AbsSeq::add(val); 164 AbsSeq::add(val);
161 165
162 // get the oldest value in the sequence... 166 // get the oldest value in the sequence...
163 double old_val = _sequence[_next]; 167 double old_val = _sequence[_next];