Skip to content

WIP: Python variable coefficients and memory leak issues

Dave Moxey requested to merge dmoxey/nektar:feature/python-varcoeffs into master

This MR addresses some issues with the Python bindings and brings a few new functionalities:

  • It was possible for memory to be leaked or pre-emptively freed through the chain of C++ allocation -> Python -> C++, since the original C++ Array was not aware of the Python -> C++ step. This has been addressed by changing the Python pointers to a double pointer shared by all Arrays, in a similar manner to m_count, so that they can be updated during the conversion step.
  • Although reference counters seem to be accurate, segfaults can arise if C++ tries to deallocate Python arrays after execution has finished (i.e. whilst Python is cleaning up). Presumably this is because the gc is essentially ignoring reference counters during this step, so we bypass decrementing Python counters if Python is not initialised.
  • Support for passing variable coefficients added in the HelmSolve call.
  • A rudimentary wrapper for the Comm class has been added, which allows for at least a small amount of communication to be performed (mostly using AllReduce).

Merge request reports