lib/quarry/src/data_set/sparse/sparse_example.h in thera-0.0.7 vs lib/quarry/src/data_set/sparse/sparse_example.h in thera-0.0.8

- old
+ new

@@ -1,10 +1,11 @@ #ifndef __sparse_data_set_example_h__ #define __sparse_data_set_example_h__ #include "data_set/example.h" #include <stdlib.h> #include <string> +#include <iostream> using namespace std; namespace DataSet { class SparseDataSet; @@ -21,9 +22,14 @@ SparseExample(int buffer_size = 0) : Example(0), buffer_size(buffer_size) { if(buffer_size > 0) values = (Value *) calloc(sizeof(Value), buffer_size); else values = NULL; + } + + ~SparseExample() { + if(values != NULL) + free(values); } double get_value(int feature_index); double get_value(string feature_name, SparseDataSet *data_set); void set_value(int feature_index, double new_value);