ClrDebug(panels[i]) calls itself again and not procedure ClrDebug(panel: integer)... So stack overflow happens. If you need it only for integers then declare it as: procedure ClrDebug(const panels: array of integer) -- cobines