Author Topic: Possible memory error when accessing model part from base strategy  (Read 265 times)

MikeA

  • Newbie
  • *
  • Posts: 21
Possible memory error when accessing model part from base strategy
« on: September 26, 2016, 11:15:18 AM »
I am working on a strategy and was calling a Clear() function in the destructor. Within the Clear() function I had something like:

const auto rank = BaseType::GetModelPart().GetCommunicator().MyPID();

This was occasionally throwing segmentation faults, presumably because a reference to the model part is stored in the base strategy and the model part was being deallocated before the strategy. This code was only used for verbosity information and I have since removed it. Nevertheless, I think such potential invalid references in the core should be eliminated if possible.