hi there,

sorry if the subject line is a bit weird, but i don't really know how to
put it in 80something characters...

i have the problem that at a point i'm calling gsl_spline_free() without
really knowing if the pointer i pass as an argument really points to
something valid:

SimpleInterpolator::~SimpleInterpolator() {
  for (int d = 0; d < 2; d++) {
    for (int i = 0; i < latsize; i++) {
      std::cout << "  freeing spline ..." << std::endl;
      gsl_spline_free(lat_splines[d][i]);
      std::cout << "     ... done!" << std::endl;
      std::cout << "  freeing accelerator ..." << std::endl;
      gsl_interp_accel_free(lat_accelerators[d][i]);
      std::cout << "     ... done!" << std::endl;
    }
    delete [] lat_accelerators[d];
    delete [] lat_splines[d];
    delete [] interp_lat_values[d];
  }
  delete [] lat_accelerators;
  delete [] lat_splines;
  delete [] interp_lat_values;
}

If, for some reason, not all indices of lat_slines[][] have been
initialised with splines, i get an EAccessViolation when running the
program.

So I thought I could get around this problem by doing something like

if lat_splines[d][i] is instanceof gsl_spline then
gsl_spline_free(lat_splines[d][i]).

How could this work?

Thanks for all your help!

Andreas.



_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to