mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-09 10:47:53 +02:00
fix a leak in StdDev
This commit is contained in:
parent
c04e653cf3
commit
4fd22914c0
2 changed files with 9 additions and 6 deletions
|
@ -13,14 +13,15 @@
|
|||
#include <cmath>
|
||||
#include "StdDev.h"
|
||||
|
||||
const int NUM_SAMPLES = 1000;
|
||||
|
||||
StDev::StDev() {
|
||||
_data = new float[NUM_SAMPLES];
|
||||
_sampleCount = 0;
|
||||
StDev::StDev() :
|
||||
_data(),
|
||||
_sampleCount(0)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
void StDev::reset() {
|
||||
memset(&_data, 0, sizeof(_data));
|
||||
_sampleCount = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef hifi_StdDev_h
|
||||
#define hifi_StdDev_h
|
||||
|
||||
const int NUM_SAMPLES = 1000;
|
||||
|
||||
class StDev {
|
||||
public:
|
||||
StDev();
|
||||
|
@ -21,7 +23,7 @@ public:
|
|||
float getStDev() const;
|
||||
int getSamples() const { return _sampleCount; }
|
||||
private:
|
||||
float* _data;
|
||||
float _data[NUM_SAMPLES];
|
||||
int _sampleCount;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue