Changeset 1960


Ignore:
Timestamp:
Dec 4, 2009 10:43:24 PM (11 years ago)
Author:
jwatson
Message:

Fixed a major memory leak in the solver manager. When get_results() was previously invoked, the action handle was referenced as a key in the map, and the corresponding results object was deleted. However, it wasn't cleaned up in the solver manager results map. Consequently, the solver manager kept a copy of every result object ever created, which reaches GB size for long PH runs.

This *might* result in a slight change in semantics, but I don't think so: once a solver result is returned from the manager, whoever got it "owns it". In other words, you can't grab the result multiple times.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.opt/trunk/coopr/opt/parallel/manager.py

    r1768 r1960  
    174174        """
    175175        if ah.id in self.results:
    176             return self.results[ah.id]
     176            # extremely important - clean up the map before returning the result.
     177            # otherwise, it will be around forever, acting as a memory leak (because
     178            # the solver manager will always retain a reference).
     179            result = self.results[ah.id]
     180            del self.results[ah.id]
     181            return result
    177182        return None
    178183
Note: See TracChangeset for help on using the changeset viewer.