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

Memory leak #6

Open
juanep97 opened this issue Aug 10, 2023 · 7 comments
Open

Memory leak #6

juanep97 opened this issue Aug 10, 2023 · 7 comments

Comments

@juanep97
Copy link

Repeated calls to the astrometry solver (hundreds) end up increasing the allocated memory until it overflow (currently circumvented it in my script by spawning a forked process for each field; which frees the allocated memory).

Versions:

  • python 3.10.9
  • astrometry 4.1.2

Steps to reproduce:

  • Repeatedly solve a field hundreds of times (can be the same field, over a loop).

(thanks for the nice module, btw)

@alexw-im
Copy link

Just wanted to say thank you for catching this and mentioning it!

@juanep97
Copy link
Author

I will add a test scenario, if you think it's useful; although I don't know if this will be a problem of astrometry or astrometry.net.

@alexw-im
Copy link

I've just noticed that it seems @rlancaste ran across maybe the same memory leaks when adapting Astrometry.net for StellarSolver: dstndstn/astrometry.net#183 (comment)

Perhaps @aMarcireau could compare notes to find and fix them if and when it's a priority!

@rlancaste
Copy link

Yes, there definitely were some memory leaks. I had to correct a bunch of them as best I could so that KStars did not have significant memory leaks when plate solving. I cannot guarantee that every change I made was the best solution, but I tried my best. I think I managed to fix all the biggest ones. There also were some issues I never resolved, but it got to the point where they were pretty small issues and did not significantly affect performance.

@alexw-im
Copy link

Yes, there definitely were some memory leaks. I had to correct a bunch of them as best I could so that KStars did not have significant memory leaks when plate solving.

Do you happen to know whether any of them got up-streamed into the original astrometry.net repo?

Aside - thank you for your work! I've only recently taken up any kind of active interest in astrophotography and the first thing I realized is that 99% of the barrier to entry is the effort in realizing which tools do what you're trying to accomplish and figuring out how to jam them all together. Stellar solver in Kstars really goes a long way on that front.

@rlancaste
Copy link

So I know at least one person was mentioning that they wanted to try to upstream some of my changes. I do not have the time to do that now. I am a full time Physics and Computer Science teacher. I had to the time to do StellarSolver during the pandemic, but now that we are back full time and I have a couple of other projects I have been working on, I haven't had time for as much open source coding.

@juanep97
Copy link
Author

juanep97 commented Nov 28, 2023

Sorry, I'm quite busy lately with academic life... I add a note here for when I have time to dive and check the origin of the memory leak. I realized (2) below also happens:

  1. Memory leaks if the solver is invoked repeatedly many times, even if running for a short time. Memory is not freed.
  2. Memory increases to ~tens of GB only in one run, if position hint separation is high (180 deg).

It seems to be related to the loading of index files, maybe memory is not released after loading them

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

3 participants