Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Java
  4. Application gives a java.lang.OutOfMemoryError when run from CLI

Application gives a java.lang.OutOfMemoryError when run from CLI

Scheduled Pinned Locked Moved Java
javahtmlapachevisual-studiocom
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bill Moo
    wrote on last edited by
    #1

    Hello, I have a java application written using the Eclipse IDE and when I run it from within the IDE all works as expected. However, if I run the same application from the command line then it fails while executing:

    java.lang.OutOfMemoryError: Java heap space
    at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createChunk(DeferredDocumentImpl.java:1932)
    at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.ensureCapacity(DeferredDocumentImpl.java:1825)
    at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createNode(DeferredDocumentImpl.java:1842)
    at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createDeferredAttribute(DeferredDocumentImpl.java:503)
    at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setDeferredAttribute(DeferredDocumentImpl.java:421)
    at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.startElement(AbstractDOMParser.java:1075)
    at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.emptyElement(AbstractDOMParser.java:1103)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1320)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288

    The XML file is 14MB in size. Can you one shed some light on this?

    -- Moo

    N T 2 Replies Last reply
    0
    • B Bill Moo

      Hello, I have a java application written using the Eclipse IDE and when I run it from within the IDE all works as expected. However, if I run the same application from the command line then it fails while executing:

      java.lang.OutOfMemoryError: Java heap space
      at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createChunk(DeferredDocumentImpl.java:1932)
      at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.ensureCapacity(DeferredDocumentImpl.java:1825)
      at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createNode(DeferredDocumentImpl.java:1842)
      at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createDeferredAttribute(DeferredDocumentImpl.java:503)
      at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setDeferredAttribute(DeferredDocumentImpl.java:421)
      at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.startElement(AbstractDOMParser.java:1075)
      at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.emptyElement(AbstractDOMParser.java:1103)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1320)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
      at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288

      The XML file is 14MB in size. Can you one shed some light on this?

      -- Moo

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #2

      Rather then re-type it, just read this[^].


      Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

      B 1 Reply Last reply
      0
      • B Bill Moo

        Hello, I have a java application written using the Eclipse IDE and when I run it from within the IDE all works as expected. However, if I run the same application from the command line then it fails while executing:

        java.lang.OutOfMemoryError: Java heap space
        at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createChunk(DeferredDocumentImpl.java:1932)
        at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.ensureCapacity(DeferredDocumentImpl.java:1825)
        at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createNode(DeferredDocumentImpl.java:1842)
        at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.createDeferredAttribute(DeferredDocumentImpl.java:503)
        at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setDeferredAttribute(DeferredDocumentImpl.java:421)
        at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.startElement(AbstractDOMParser.java:1075)
        at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.emptyElement(AbstractDOMParser.java:1103)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1320)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2732)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288

        The XML file is 14MB in size. Can you one shed some light on this?

        -- Moo

        T Offline
        T Offline
        TorstenH
        wrote on last edited by
        #3

        It is not just a matter of memory that is assigned to the VM. :thumbsdown:you need to find your failure! :thumbsdown: You have somewhere in there a infinite loop. That one is creating objects / reading data / ...filling up the memory with bits and in the end crashing your application with a heap space failure. Find that loop! fix it. There is no other way around it. Debug through your code and find the never ending loop. There is no Exception defined for such a failure, so you need to find that manually. Good luck and keep us informed whether you'd find it. Coffee and chocolate helps.

        regards Torsten When I'm not working

        1 Reply Last reply
        0
        • N Nagy Vilmos

          Rather then re-type it, just read this[^].


          Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

          B Offline
          B Offline
          Bill Moo
          wrote on last edited by
          #4

          Thank you for the reply but I of course should have mentioned that I have tried this. Not the VisualVM but increasing the usable memory. I can allocate a max of 320m but anything more and I get :

          Error occurred during initialization of VM
          Could not reserve enough space for object heap
          Error: Could not create the Java Virtual Machine.
          Error: A fatal exception has occurred. Program will exit.

          But when it does start in this case with 320m I get

          A fatal error has been detected by the Java Runtime Environment:

          java.lang.OutOfMemoryError: requested 198896 bytes for Chunk::new. Out of swap space?

          Internal Error (allocation.cpp:272), pid=25971, tid=8792264704

          Error: Chunk::new

          JRE version: 7.0

          Java VM: OpenJDK 64-Bit Server VM (20.0-b03 mixed mode bsd-amd64 compressed oops)

          An error report file with more information is saved as:

          So I am still a bit confused, but I downloaded the VisualVM and I'll see what it can tell me. The machine is SMP running OpenBSD v5 and has 6GB of memory and 5.9G of available.

          -- Moo

          J 1 Reply Last reply
          0
          • B Bill Moo

            Thank you for the reply but I of course should have mentioned that I have tried this. Not the VisualVM but increasing the usable memory. I can allocate a max of 320m but anything more and I get :

            Error occurred during initialization of VM
            Could not reserve enough space for object heap
            Error: Could not create the Java Virtual Machine.
            Error: A fatal exception has occurred. Program will exit.

            But when it does start in this case with 320m I get

            A fatal error has been detected by the Java Runtime Environment:

            java.lang.OutOfMemoryError: requested 198896 bytes for Chunk::new. Out of swap space?

            Internal Error (allocation.cpp:272), pid=25971, tid=8792264704

            Error: Chunk::new

            JRE version: 7.0

            Java VM: OpenJDK 64-Bit Server VM (20.0-b03 mixed mode bsd-amd64 compressed oops)

            An error report file with more information is saved as:

            So I am still a bit confused, but I downloaded the VisualVM and I'll see what it can tell me. The machine is SMP running OpenBSD v5 and has 6GB of memory and 5.9G of available.

            -- Moo

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            Bill.Moo wrote:

            I can allocate a max of 320m but anything more and I get ...64-Bit Server VM...OpenBSD v5 and has 6GB

            Not sure what the original problem is but the above suggests something is really wrong with your platform and/or however you are attempting to run that.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups