Sorry to double-guess but if this is some sort of tilemap can't you have the array the maximum height/width you will allow and display the tiles with a loop from a start_xpos for how many tiles will fit in the window.
If I have jumped the gun I apologise.
If I have jumped the gun I apologise.