Commit ed322a40251dde9ee82276d7d297f68a217fa14b

Authored by Jürgen Knödlseder
1 parent 6c66c03a

Reduce memory usage by disposing the event lists after usage.

@@ -85,6 +85,9 @@ is set to the map centre. This is only identical to the pointing in @@ -85,6 +85,9 @@ is set to the map centre. This is only identical to the pointing in
85 case of binning a single event list and using the usepnt=yes option 85 case of binning a single event list and using the usepnt=yes option
86 (or specifying the pointing manually as the xref and yref parameters). 86 (or specifying the pointing manually as the xref and yref parameters).
87 87
  88 +Memory usage has been reduced by disposing the event lists after their
  89 +usage.
  90 +
88 91
89 8. ctlike - Maximum likelihood fitting 92 8. ctlike - Maximum likelihood fitting
90 -------------------------------------- 93 --------------------------------------
@@ -141,6 +144,9 @@ the use for 2D response functions in FITS files. @@ -141,6 +144,9 @@ the use for 2D response functions in FITS files.
141 ctmodel now also supports the handling of energy dispersion. Energy 144 ctmodel now also supports the handling of energy dispersion. Energy
142 dispersion can be switched on or off using the hidden edisp parameter. 145 dispersion can be switched on or off using the hidden edisp parameter.
143 146
  147 +Memory usage has been reduced by disposing the event lists after their
  148 +usage.
  149 +
144 150
145 12. ctexpcube - CTA exposure cube generation 151 12. ctexpcube - CTA exposure cube generation
146 -------------------------------------------- 152 --------------------------------------------
@@ -165,6 +171,9 @@ ctbkgcube computes the background cube for an observation definition @@ -165,6 +171,9 @@ ctbkgcube computes the background cube for an observation definition
165 file. The cube definition may be taken from a counts cube or may be 171 file. The cube definition may be taken from a counts cube or may be
166 specified by user parameters. 172 specified by user parameters.
167 173
  174 +Memory usage has been reduced by disposing the event lists after their
  175 +usage.
  176 +
168 177
169 15. ctcubemask - CTA cube filtering 178 15. ctcubemask - CTA cube filtering
170 ----------------------------------- 179 -----------------------------------
src/ctbin/ctbin.cpp
@@ -263,6 +263,9 @@ void ctbin::run(void) @@ -263,6 +263,9 @@ void ctbin::run(void)
263 // Fill the cube 263 // Fill the cube
264 fill_cube(obs); 264 fill_cube(obs);
265 265
  266 + // Dispose events to free memory
  267 + obs->dispose_events();
  268 +
266 } // endif: CTA observation found 269 } // endif: CTA observation found
267 270
268 } // endfor: looped over observations 271 } // endfor: looped over observations
src/ctbkgcube/ctbkgcube.cpp
@@ -322,6 +322,9 @@ void ctbkgcube::run(void) @@ -322,6 +322,9 @@ void ctbkgcube::run(void)
322 // Fill the cube 322 // Fill the cube
323 fill_cube(obs); 323 fill_cube(obs);
324 324
  325 + // Dispose events to free memory
  326 + obs->dispose_events();
  327 +
325 } // endif: CTA observation found 328 } // endif: CTA observation found
326 329
327 } // endfor: looped over observations 330 } // endfor: looped over observations
src/ctmodel/ctmodel.cpp
@@ -273,6 +273,9 @@ void ctmodel::run(void) @@ -273,6 +273,9 @@ void ctmodel::run(void)
273 // Fill the cube 273 // Fill the cube
274 fill_cube(obs); 274 fill_cube(obs);
275 275
  276 + // Dispose events to free memory
  277 + obs->dispose_events();
  278 +
276 } // endif: CTA observation found 279 } // endif: CTA observation found
277 280
278 } // endfor: looped over observations 281 } // endfor: looped over observations
@@ -481,8 +484,6 @@ void ctmodel::get_parameters(void) @@ -481,8 +484,6 @@ void ctmodel::get_parameters(void)
481 484
482 // Read observation definition filename and response parameters 485 // Read observation definition filename and response parameters
483 m_obsfile = (*this)["obsfile"].filename(); 486 m_obsfile = (*this)["obsfile"].filename();
484 - m_caldb = (*this)["caldb"].string();  
485 - m_irf = (*this)["irf"].string();  
486 487
487 // If no observation definition file has been specified then read all 488 // If no observation definition file has been specified then read all
488 // parameters that are necessary to create an observation from scratch 489 // parameters that are necessary to create an observation from scratch
src/ctobssim/ctobssim.cpp
@@ -323,7 +323,6 @@ void ctobssim::run(void) @@ -323,7 +323,6 @@ void ctobssim::run(void)
323 // is enabled, this loop will be parallelized. 323 // is enabled, this loop will be parallelized.
324 #pragma omp for 324 #pragma omp for
325 for (int i = 0; i < m_obs.size(); ++i) { 325 for (int i = 0; i < m_obs.size(); ++i) {
326 -std::cout << "Observation " << i << ": " << get_current_rss() << std::endl;  
327 326
328 // Get pointer on CTA observation 327 // Get pointer on CTA observation
329 GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); 328 GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]);