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

DM-31507 Explicitly run garbage collection #135

Merged
merged 1 commit into from Aug 26, 2021
Merged

Conversation

natelust
Copy link
Contributor

Some objects are not cleaned up until garbage collection is run,
which can happen at unpredictable times. Run collection explicitly
to make sure memory is freed. This HOPEFULLY will only be third
party objects, and none of our own.

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

Some objects are not cleaned up until garbage collection is run,
which can happen at unpredictable times. Run collection explicitly
to make sure memory is freed. This HOPEFULLY will only be third
party objects, and none of our own.
Copy link
Collaborator

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one suggestion.

# sqlalchemy has some objects that can last until a garbage
# collection cycle is run, which can happen at unpredictable
# times, run a collection loop here explicitly.
gc.collect()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running GC frequently can be very expensive, I wonder if we could avoid pessimization by running it conditionally. In my old project when I did something similar I only ran it when virtual mem size increased significantly since last explicit CG. This of course needs some guessing as to what makes a significant increase, in that project threshold was something like 10MB, but it clearly depends on growth pattern.

@natelust natelust merged commit 461c868 into master Aug 26, 2021
@natelust natelust deleted the tickets/DM-31507 branch August 26, 2021 18:23
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

Successfully merging this pull request may close these issues.

None yet

2 participants