Exception in thread "main"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robert22
    New Member
    • Mar 2020
    • 5

    Exception in thread "main"

    I am getting the error: Exception in thread "main" java.lang.OutOf MemoryError: Java heap space.
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    Use the -xms and -xmx flags to allocate more memory.

    Comment

    • robert22
      New Member
      • Mar 2020
      • 5

      #3
      okay i will try that.

      Comment

      • dev7060
        Recognized Expert Contributor
        • Mar 2017
        • 656

        #4
        The default memory is usually 64m. So I believe -Xmx256m would work well. More options to control memory use can be viewed by the java -X command.

        Comment

        • Ishan Shah
          New Member
          • Jan 2020
          • 47

          #5
          java.lang.OutOf MemoryError exception can also be thrown by native library code when a native allocation can't be satisfied. Following are the various cases when the OutOfMemory error might occur:

          1) Due to Java Heap Space
          2) When the GC Overhead limit exceeded
          3) Permgen space is thrown
          4) Metadata is allocated in native memory. if metaspace for class metadata is exhausted
          5) Requested array size exceeds VM limit

          Comment

          Working...