In the ::apply method, when the image data need to be re-uploaded, the Texture2DArray checks if the TextureObject can be re-used. The test was made using the constant 1 instead of the real texture depth, so the TextureObject was never re-used.