Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vinay0000 opened this issue Jan 14, 2022 · 0 comments

Comments

@vinay0000
Copy link
Collaborator

vinay0000 commented Jan 14, 2022

  • 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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant