Skip to content
Snippets Groups Projects
  • Jared Hancock's avatar
    queryset: Fix circular reference error · e657a33e
    Jared Hancock authored
    This fixes an error where the ModelInstanceManager maintained a reference to
    the QuerySet instance, and the QuerySet instance managed a reference to the
    ModelInstanceManager instance (if it's the iterator for the query). Because
    of the circular reference, if the iterator is not exhausted, then the
    resource is not closed and the query remains open. This wastes memory and
    prevents some other queries from running after such a situation happens.
    
    This addresses the issue by removing the circular reference between the
    QuerySet and the ModelInstanceManager.
    e657a33e