I am trying to compute the largest number that my computer can compute at any given time (obviously this number will change depending on what my computer is doing at the time). In order to do this I am trying to be as economical with my memory usage as possible.
There are various methods I am trying, one of which is using a for loop and a try catch statement to increment the number by itself until it throws a runtime error and then printing the result to the screen. However, this requires the use of BigInteger, and since BigInteger is immutable I have to create a new BigInteger during every iteration of the loop, each one larger than the last. This takes up much more memory than I want it too. Is there a way to wipe older BigIntegers off the memory once they have been used to create the next larger BigInteger?