Remove python reference cycles in high-level Modulestore code

Description

At the top of most of our modulestores, there are cycles created that end up putting a lot of memory pressure on the garbage collector whenever working with large courses or many students (such as during grading). If we break those cycles with WeakReferences, then we should be able to free memory when grading is finished, without relying on a garbage collection cycle.

http://pymotw.com/2/weakref/#cyclic-references

Acceptance Criteria:

  • A test decorator that measures cycles that haven't been garbage collected

  • A decorated test that shows that the cycles exist in the current code

  • A change to remove the cycles, with changes to test results to verify.

Steps to Reproduce

None

Current Behavior

None

Expected Behavior

None

Reason for Variance

None

Release Notes

None

User Impact Summary

None

Assignee

Unassigned

Reporter

Calen Pennington

Labels

Reach

None

Impact

None

Platform Area

None

Customer

None

Partner Manager

None

URL

None

Contributor Name

None

Groups with Read-Only Access

None

Actual Points

None

Category of Work

None

Platform Map Area (Levels 1 & 2)

None

Platform Map Area (Levels 3 & 4)

None

Story Points

8

Priority

Unset
Configure