lightkurve: Memory error - KeplerTargetPixelFile iteration
Problem description
When iterate over KeplerTargetPixelFile object clogging of memory occure.
Example
from lightkurve import KeplerTargetPixelFile
tpf = KeplerTargetPixelFile(filename)
for i, frame in enumerate(tpf):
pass
Behavior
Over 1,000 megabytes ram for i = 250. This same behavior for jupyter, ipython, python sheel.
Environment:
- platform Linux
- lightkurve version: 1.0b21
- installation method: conda
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 20 (5 by maintainers)
Haven’t been around lightkurve much lately because of commitments to cryptography projects. But, memory leaks are critical issues. When I have time, I’ll look at the tests some more.
FWIW adapting the mprof script to this example (BTW with Python 3.11.4 under macOS 12.7 on M1 (arm64) CPU, so quite different setting)
I find this memory usage for the first couple iterations with 2.4.0:
in comparison with 2.4.1
and so on, continuing to accumulate some ¼ GB memory usage per iteration, i.e. apparently the memory from each newly loaded tpf is never released again (does not matter whether I run
del tpfor not, or if I only download a single tpf with.download()– in the latter case the increment is just reduced to ~226 MB).Probably not related to the original bug reported here, but definitely an issue!