Commit 193bb52548f6c0a7a1a0b7acc39509c9cfa95fb8

Authored by David Mayerich
1 parent dd3ebeec

fixed memory leak in GPU covariance calculation

Showing 2 changed files with 3 additions and 2 deletions   Show diff stats
stim/envi/bip.h
... ... @@ -235,6 +235,7 @@ public:
235 235  
236 236 for(unsigned long long i = 0; i < B; i++) //for each element of the spectrum
237 237 p[i] = (double) temp[i]; //cast each element to a double value
  238 + free(temp); //free temporary memory
238 239 return true;
239 240 }
240 241  
... ...
stim/parser/table.h
... ... @@ -55,7 +55,7 @@ namespace stim{
55 55 }
56 56  
57 57 void save_ascii(std::string filename, char col_delim = ',', char row_delim = '\n'){
58   - ofstream outfile(filename);
  58 + std::ofstream outfile(filename);
59 59 for(size_t yi = 0; yi < TABLE.size(); yi++){
60 60 if(yi != 0 && TABLE[yi].size() > 0) outfile<<row_delim;
61 61 for(size_t xi = 0; xi < TABLE[yi].size(); xi++){
... ... @@ -66,7 +66,7 @@ namespace stim{
66 66 }
67 67  
68 68 void read_ascii(std::string filename, char col_delim = ',', char row_delim = '\n'){
69   - ifstream infile(filename); //open an ascii file for reading
  69 + std::ifstream infile(filename); //open an ascii file for reading
70 70 TABLE.clear(); //empty out the table
71 71  
72 72 std::string line;
... ...