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

Do not explicitly call gc.collect in CompImageHDU.compressed_data #14576

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions astropy/io/fits/hdu/compressed.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Licensed under a 3-clause BSD style license - see PYFITS.rst

import ctypes
import gc
import itertools
import math
import re
Expand Down Expand Up @@ -1607,12 +1606,6 @@ def compressed_data(self):
# do some additional cleanup
del self.__dict__["compressed_data"]

# If this file was mmap'd, numpy.memmap will hold open a file
# handle until the underlying mmap object is garbage-collected;
# since this reference leak can sometimes hang around longer than
# welcome go ahead and force a garbage collection
gc.collect()

@property
def shape(self):
"""
Expand Down
2 changes: 2 additions & 0 deletions docs/changes/io.fits/14576.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Do not call ``gc.collect()`` when closing a ``CompImageHDU`` object as it has a
large performance penalty.