Create error "Failed to reserve space for object heap"
5 answers
You can use an arbitrary amount of memory by running several scripts that look like this:
public static void main(String[] args)
{
List<String> l = new ArrayList<String>();
for (long i = 0 ; i < 100000000l ; i++)
{
l.add(new String("AAAAAAA"));
}
}
With a large enough heap space (e.g. -Xmx1024M). The problem is that any modern OS will try to use virtual memory in order for the application to still function, which will cause your hard drive to start thrashing rather than going out of memory for the JVM. You may need to set the OS shared swap space to something that is really related to this scenario.
-1
a source to share