Java Heap is a limit on the size of objects that you can have on the system. If the size of your object is outside the heap, then an "Out of memory" error is generated.
In your case, your total size of the object (the object in ArrayList + other objects in your system) matters more, since your ArrayList will simply refer to these objects.
Here are the VM parameters that you can use to set the heap size according to your requirement (from the java documentation ):
-Xms p
Specify the initial size in bytes of the memory allocation pool. This value must be a multiple of 1024 greater than 1 MB. Attach the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 2 MB. Examples:
-Xms6291456
-Xms6144k
-Xms6m
-Xmx p
Specify the maximum size in bytes of the memory allocation pool. This value must be a multiple of 1024 greater than 2MB. Attach the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64 MB. Examples:
-Xmx83886080
-Xmx81920k
-Xmx80m
Check heap contents from VM specification
3.5.3 Heap
The Java virtual machine has a bunch that is common to all Java virtual machines. The heap is the runtime data area from which memory is allocated for all instances of the class and> arrays. The heap is created when the virtual machine starts. Heap storage for objects is regenerated by the automatic storage management system (known as the garbage collector); objects are never> explicitly released. The Java virtual machine does not accept a specific type of automated storage management system, and storage management technology can be selected in accordance with the requirements of the developing system. The heap can have a fixed size or it can be> expanded as required by the calculation, and can be reduced if a large heap becomes unnecessary. Heap memory does not have to be contiguous.
Implementation of the Java virtual machine can give the programmer or user control over the initial heap size, and also, if the heap can dynamically expand or> shrink, control the maximum and minimum heap size.
The following exceptional condition is associated with the heap:
If more heap is required for the calculation than can be provided by the automatic storage management system, the Java virtual machine throws an OutOfMemoryError.