terrapower / armi

An open-source nuclear reactor analysis automation framework that helps design teams increase efficiency and quality
https://terrapower.github.io/armi/
Apache License 2.0
212 stars 82 forks source link

Deleting objects that are still trying to hold on to old reactor after reset #1750

Closed zachmprince closed 4 days ago

zachmprince commented 4 days ago

What is the change?

This change is a follow on to #1729 after it was observed that the garbage collector was not clearing Reactor data from a state distribution on worker processors after a reset. This is due to objects retaining references to the distributed Reactor. Upon investigation, these references came from a cyclic reference between Core, Reactor, and spatialGrid objects, shown by this diagram created by objgraph:

image

The solution was quite simple: setting spatialGrid.armiObject attribute to None, as well as the parent attribute in the Reactor children.

Why is the change being made?

Retaining the distributed state of the Reactor on workers is unnecessary memory overhead for interactions that don't require a distributed state.


Checklist

zachmprince commented 4 days ago

Approved from my end! Not sure this can be tested, so I'll let John S comment on that.

Coming up with the test for this is not trivial to me. I'm not even sure what would be tested. Plus, the effectiveness of the change is largely dependent on the plugins and what interfaces are active.

Could you add this and the previous PR to the release notes? I think they are pretty important-to-mention updates!

Added an item to the release notes. I wasn't sure whether to put it at the top or bottom of the list lol.