As far as I can tell, there are four possibilities:
Ubuntu doesn't limit the memory per process by default, but there are ways to set up those limits. The easiest way of knowing what has been done (if anything) would be consulting the person who administrates the server.
If you're on a VPS and not on an actual server, there might be a problem with the configuration of the VM.
I don't know exactly how Java works, but C restricts the memory available to the stack when compiling. In this case, you can either instruct the compiler to increase the stack size or move larger arrays to the heap.
If your OS is 32-bit, the available memory per process is hard-limited (somewhere between 2 GB and 4 GB). If your server has a 64-bit CPU, that can be fixed easily by installing a 64-bit OS.
Possibility 4 is pretty easy to rule out. To verify whether it's 1, 2 or 3, you could compile the following with gcc (or write the equivalent in Java):
int main(int argc, char **argv)
long bytes = atol(argv), counter, *pointer, words = bytes / sizeof(long);
// try to allocate memory
if ((pointer = malloc(bytes)) == NULL)
puts("Could not allocate memory");
// play with memory, so compiler won't optimize allocation out
for(counter = 0; counter < words; counter++)
pointer[counter] = counter;
and execute it the the amount of memory you want to allocate as a command-line option.
You should be able to allocate all memory that's reported as free or cached. If you can,
you rule out possibility 1 and possibly 2.