Free cookie consent management tool by TermsFeed Policy Generator

Ticket #1268: MemoryLeak.patch

File MemoryLeak.patch, 1.1 KB (added by svonolfe, 14 years ago)
  • HeuristicLab.Optimization/3.3/Run.cs

     
    8686    }
    8787
    8888    private void Initialize(IAlgorithm algorithm) {
    89       IAlgorithm clone = (IAlgorithm)algorithm.Clone();
    9089      parameters = new Dictionary<string, IItem>();
    9190      results = new Dictionary<string, IItem>();
    92       clone.CollectParameterValues(parameters);
    93       clone.CollectResultValues(results);
    94       if (clone.StoreAlgorithmInEachRun) {
     91
     92      if (algorithm.StoreAlgorithmInEachRun) {
     93        IAlgorithm clone = (IAlgorithm)algorithm.Clone();
     94        clone.CollectParameterValues(parameters);
     95        clone.CollectResultValues(results);
    9596        clone.Prepare(true);
    9697        this.algorithm = clone;
     98      } else {
     99        algorithm.CollectParameterValues(parameters);
     100        algorithm.CollectResultValues(results);
    97101      }
    98102    }
    99103    [StorableHook(HookType.AfterDeserialization)]