Ignore:
Timestamp:
Mar 12, 2010 11:50:18 AM (9 years ago)
Author:
jwatson
Message:

Disabling garbage collection in PySP during instance construction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pysp/trunk/coopr/pysp/ph.py

    r2441 r2442  
    613613      self._converger.reset()
    614614
    615       # construct the instances for each scenario
     615      # construct the instances for each scenario.
     616      #       
     617      # garbage collection noticeably slows down PH when dealing with
     618      # large numbers of scenarios. disable prior to instance construction,
     619      # and then re-enable. there isn't much collection to do as instances
     620      # are constructed.
     621      re_enable_gc = gc.isenabled()
     622      gc.disable()
     623     
    616624      if self._verbose is True:
    617625         if self._scenario_tree._scenario_based_data == 1:
     
    631639         self._instances[scenario._name].name = scenario._name
    632640         self._instance_augmented_attributes[scenario._name] = []
     641
     642      # perform a single pass of garbage collection and re-enable automatic collection.
     643      if re_enable_gc is True:
     644         gc.collect()
     645         gc.enable()         
    633646
    634647      # let plugins know if they care - this callback point allows
Note: See TracChangeset for help on using the changeset viewer.