GeminiDRSoftware / astrodata

https://geminidrsoftware.github.io/astrodata/
Other
1 stars 2 forks source link

[BUG] DRAGONS memory issue #61

Open teald opened 1 month ago

teald commented 1 month ago

DRAGONS has been experience memory issues with certain datasets/images. This memory seems to be exploding due to something related to astrodata.

Describe the bug Memory explodes when certain astropy models are used (e.g., Chebyshev2D).

To Reproduce Using memory_profiler and astropy (and nothing else):

from astropy.modeling.models import Chebyshev2D
import numpy as np
from memory_profiler import profile
import gc

@profile
def main():
    x = np.linspace(0, 1, 1_000_000, dtype=np.float32)
    y = x**2 + 1

    model1 = Chebyshev2D(3, 3)

    result1 = model1(x, y)

    model2 = Chebyshev2D(4, 4)

    result2 = model2(x, y)

    model3 = Chebyshev2D(10, 10)

    result3 = model3(x, y)

    # Garbage collection does not help, because there are
    # references left over in the model object.

if __name__ == "__main__":
    main()

Expected behavior Not this.

teald commented 1 month ago

This is tracked in an astropy issue, now: https://github.com/astropy/astropy/issues/17094