using HeuristicLab.Core;

namespace HeuristicLab.Problems.ProgramSynthesis {
  public class PooledPushInterpreter : PushInterpreter {

    private readonly PushInterpreterPool pool;

    public PooledPushInterpreter(PushInterpreterPool pool, IReadOnlyPushConfiguration config, InterpreterPoolContainer poolContainer, IRandom random = null)
      : base(config, random, poolContainer) {
      this.pool = pool;
    }

    public override void Dispose() {
      base.Dispose();
      ClearStacks();
      pool.Free(this);
    }
  }
}