Noch etwas, das i hast du als int deklariert, bis 500000 ist das wohl ein Problem.