The problem sounds like you're using a poor algorithm. A 10,000,000 int array takes ~38MB of memory, easily handled by most modern systems (even fairly old systems can handle 38MB).

From your...