Program: 5492
Project: 5492
Buggy source:
private void setup(){
  if (chartPanel != null)   return;
  chartPanel=new ChartPanel();
  ConstantLineChart maxChart=new ConstantLineChart("String_Node_Str",this.stackStartAddress - this.heapStartAddress);
  maxChart.setConfig("String_Node_Str",Color.red);
  chartPanel.addChart(maxChart);
  minStackChart=new LineChart("String_Node_Str");
  minStackChart.setConfig("String_Node_Str",Color.green);
  chartPanel.addChart(minStackChart);
  maxStackChart=new LineChart("String_Node_Str");
  maxStackChart.setConfig("String_Node_Str",Color.green);
  chartPanel.addChart(maxStackChart);
  chartPanel.setAxisChart(maxStackChart);
  add(chartPanel,BorderLayout.CENTER);
  chartPanel.setMinimumSize(new Dimension(320,200));
  setPreferredSize(new Dimension(320,200));
  setSize(320,200);
  setMinimumSize(new Dimension(320,200));
  WindowManager wm=registry.getComponent(WindowManager.class);
  if (wm != null) {
    window=wm.createWindow("String_Node_Str");
    window.add(this);
  }
  registerMonitor=new RegisterMonitor.Adapter(){
    @Override public void notifyWriteBefore(    int type,    int adr,    int data){
      int size=((stackStartAddress - data) + 0xffff) % 0xffff;
      if (minData[pos] > size) {
        minData[pos]=size;
      }
      if (maxData[pos] < size) {
        maxData[pos]=size;
      }
      if (cpu.cpuCycles - lastCycles > updateCyclePeriod) {
        lastCycles=cpu.cpuCycles;
        pos=(pos + 1) % minData.length;
        minData[pos]=Integer.MAX_VALUE;
        maxData[pos]=0;
        update=true;
        repaint();
      }
    }
  }
;
}

Fixed version (ground truth):
private void setup(){
  if (chartPanel != null)   return;
  if (this.heapStartAddress < 0 && cpu.getDisAsm() != null) {
    MapTable mapTable=cpu.getDisAsm().getMap();
    if (mapTable != null) {
      this.heapStartAddress=mapTable.heapStartAddress;
      this.stackStartAddress=mapTable.stackStartAddress;
    }
  }
  if (this.stackStartAddress < 0) {
    this.stackStartAddress=cpu.config.ramStart + cpu.config.ramSize;
  }
  chartPanel=new ChartPanel();
  if (this.stackStartAddress > 0 && this.heapStartAddress > 0) {
    ConstantLineChart maxChart=new ConstantLineChart("String_Node_Str",this.stackStartAddress - this.heapStartAddress);
    maxChart.setConfig("String_Node_Str",Color.red);
    chartPanel.addChart(maxChart);
  }
  minStackChart=new LineChart("String_Node_Str");
  minStackChart.setConfig("String_Node_Str",Color.green);
  chartPanel.addChart(minStackChart);
  maxStackChart=new LineChart("String_Node_Str");
  maxStackChart.setConfig("String_Node_Str",Color.green);
  chartPanel.addChart(maxStackChart);
  chartPanel.setAxisChart(maxStackChart);
  add(chartPanel,BorderLayout.CENTER);
  chartPanel.setMinimumSize(new Dimension(320,200));
  setPreferredSize(new Dimension(320,200));
  setSize(320,200);
  setMinimumSize(new Dimension(320,200));
  WindowManager wm=registry.getComponent(WindowManager.class);
  if (wm != null) {
    window=wm.createWindow("String_Node_Str");
    window.add(this);
  }
  registerMonitor=new RegisterMonitor.Adapter(){
    @Override public void notifyWriteBefore(    int register,    int data,    int mode){
      int size=stackStartAddress - data;
      if (minData[pos] > size) {
        minData[pos]=size;
      }
      if (maxData[pos] < size) {
        maxData[pos]=size;
      }
      if (cpu.cpuCycles - lastCycles > updateCyclePeriod) {
        lastCycles=cpu.cpuCycles;
        pos=(pos + 1) % minData.length;
        minData[pos]=Integer.MAX_VALUE;
        maxData[pos]=0;
        update=true;
        repaint();
      }
    }
  }
;
}