 <p>From the small code snippet you shared, it's hard to say what the problem really is. </p> <p>I can only suspect that the result of <code>GPSC.size()</code> is bigger than what an <code>int</code> can store, therefore causing an overflow on <code>i</code> after <em>some</em> iterations.</p>