Index: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Pool/ManagedPoolProvider.cs
===================================================================
--- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Pool/ManagedPoolProvider.cs	(revision 14777)
+++ branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Pool/ManagedPoolProvider.cs	(revision 14834)
@@ -5,5 +5,5 @@
   using System.Collections.Concurrent;
   using System.IO;
-  using System.Linq;
+  using System.Reflection;
   using System.Runtime.Serialization.Formatters.Binary;
 
@@ -18,4 +18,8 @@
     private byte[] dummyPartition;
 
+    private static readonly FieldInfo InternalListArrayProperty = typeof(List<T[]>).GetField(
+      "_items",
+      BindingFlags.NonPublic | BindingFlags.Instance);
+
     private readonly Func<T> factory;
 
@@ -29,5 +33,5 @@
       this.factory = factory;
 
-      managedPools = new ObjectPool<IManagedPool<T>>(() => new ManagedPool<T>(this), MaxParitionCount);
+      managedPools = new ObjectPool<IManagedPool<T>>(() => new ManagedPool(this));
     }
     public int InstanceCount { get { return partitions.Count * PartitionSize; } }
@@ -46,7 +50,7 @@
     }
 
-    public void ReleasePartitions(params T[][] partition) {
-      if (partitions.Count <= MaxParitionCount && partition.Length > 0)
-        partitions.PushRange(partition);
+    public void ReleasePartitions(List<T[]> releasedPartitions) {
+      if (partitions.Count < MaxParitionCount)
+        partitions.PushRange((T[][])InternalListArrayProperty.GetValue(releasedPartitions), 0, releasedPartitions.Count);
     }
 
@@ -71,7 +75,7 @@
     }
 
-    private class ManagedPool<T> : IManagedPool<T> where T : class, IPooledObject {
+    private class ManagedPool : IManagedPool<T> {
       private readonly ManagedPoolProvider<T> provider;
-      private readonly IList<T[]> partitions = new List<T[]>();
+      private readonly List<T[]> partitions = new List<T[]>();
       private T[] currentPartition;
       private int entryIndex;
@@ -82,5 +86,5 @@
       }
 
-      public T Get(bool reset = true) {
+      public T Get(bool resetEntry = true) {
         if (entryIndex == provider.PartitionSize) {
           currentPartition = provider.GetPartition();
@@ -90,14 +94,16 @@
 
         var entry = currentPartition[entryIndex++];
-
-        if (reset) entry.Reset();
-
+        if (resetEntry) entry.Reset();
         return entry;
       }
 
       public void Dispose() {
-        provider.ReleasePartitions(partitions.ToArray());
-        partitions.Clear();
-        entryIndex = provider.PartitionSize;
+        if (partitions.Count > 0) {
+          provider.ReleasePartitions(partitions);
+          partitions.Clear();
+          currentPartition = null;
+          entryIndex = provider.PartitionSize;
+        }
+
         provider.managedPools.Free(this);
       }
Index: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Pool/PooledObject.cs
===================================================================
--- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Pool/PooledObject.cs	(revision 14834)
+++ branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Pool/PooledObject.cs	(revision 14834)
@@ -0,0 +1,26 @@
+﻿namespace HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool {
+  using System;
+
+  public class PooledObject<T> : IDisposable, IPooledObject
+    where T : class {
+
+    private readonly ObjectPool<PooledObject<T>> pool;
+    private readonly T item;
+    private readonly Action<T> resetor;
+
+    public PooledObject(ObjectPool<PooledObject<T>> pool, T item, Action<T> resetor) {
+      this.pool = pool;
+      this.item = item;
+      this.resetor = resetor;
+    }
+
+    public virtual void Dispose() {
+      this.resetor(this.item);
+      this.pool.Free(this);
+    }
+
+    public void Reset() {
+      this.resetor(this.item);
+    }
+  }
+}
Index: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Tree/TreeExtensions.cs
===================================================================
--- branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Tree/TreeExtensions.cs	(revision 14777)
+++ branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Data/Tree/TreeExtensions.cs	(revision 14834)
@@ -27,8 +27,8 @@
     }
 
-    public static IEnumerable<TreeNode<T>> DepthFirst<T>(this TreeNode<T> node) {
+    public static IEnumerable<TreeNode<T>> DepthLast<T>(this TreeNode<T> node) {
       foreach (var child in node.Children) {
         if (child.Children.Count > 0) {
-          foreach (var subChild in child.DepthFirst()) {
+          foreach (var subChild in child.DepthLast()) {
             yield return subChild;
           }
@@ -37,8 +37,8 @@
     }
 
-    public static IEnumerable<T> DepthFirst<T>(this TreeNode<T> node, Func<IEnumerable<T>, T> resolveParent) {
+    public static IEnumerable<T> DepthLast<T>(this TreeNode<T> node, Func<IEnumerable<T>, T> resolveParent) {
       foreach (var child in node.Children) {
         if (child.Children.Count > 0) {
-          var subExpressions = child.DepthFirst(resolveParent);
+          var subExpressions = child.DepthLast(resolveParent);
           yield return resolveParent(subExpressions);
         } else yield return child.Value;
@@ -47,5 +47,5 @@
 
     public static PushProgram ToPushProgram(this TreeNode<Expression> tree, Func<Expression, bool> condition = null) {
-      var expressions = tree.DepthFirst(e => ResolveProgram(e, condition));
+      var expressions = tree.DepthLast(e => ResolveProgram(e, condition));
 
       return ResolveProgram(expressions, condition);
