Skip to content

propcov-cpp: Presence/absence of delete operations in destructor functions in Propagator, Spacecraft, CoverageChecker could cause memory problems. #15

@vinay0000

Description

@vinay0000
  • The destructor function in Propagator, Spacecraft have been modified to comment out the delete operation on objects (orbit-state, orbit-epoch, attitude, interpolator) to which the class instance variables point to. This is because the objects are created outside and not by the Propagator/Spacecraft classes, and hence it seems better to not have the classes delete them. Hope it doesn't create any problems.

    • (On the other hands the objects pointed to by the instance variables, can be changed by the respective classes, hence these objects have a 1-1 association with these classes, and hence would make sense for them to be deleted by the classes)
  • Issue with Spacecraft class: When the copy operation is used, the objects are created by the Spacecraft class itself, in which case the deletion becomes the responsibility of the Spacecraft class.

  • See the CoverageChecker class which on other hand does not create PointGroup, Spacecraft objects (in the copy function). In this case the CoverageChecker class does not change the PointGroup or Spacecraft objects. In case of Spacecraft class however the OrbitState, OrbitEpoch, Attitude, Interpolator objects can be changed by the Spacecraft class itself, which would necessitate cloning of the respective objects in the copy function.

  • Memory problems may (not sure) happen if the CoverageChecker object is copied, and the copy/ original is destroyed. (Since some objects (pointArray, centralBody) appear to be shared between the copies.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions