4 Replies Latest reply on Jul 1, 2013 3:20 PM by Kirk Fritsche

    Java Heap Space error in OSX

    Kirk Fritsche

      I'm running SQL Developer on osx 10.8.4 with Java 1.6.0_45 against Oracle

      In my preferences I have the Database->Worksheet->"Show query results in new tabs" option selected.


      After a certain number of executions of a select statement against a table I get the message "Java heap space".

      SQL Developer is then locked up and all I can do is force quit and start over, reconnection is not possible.

      If I disconnect and then re-connect prior to getting the exception then I can continue on until the limit is reached.

      If I turn off the "show query results in new tabs" option, then I don't get this error.


      The limit for me seems to be 8 selects against a 25 column table or 4 selects against a 50 column table or it will fail on the first select of a table with 135 columns.

      Note that the columns are all varchar2(2000).


      It would be great if this error could be handled more gracefully since anything else I was doing in other connections is then lost.

        • 1. Re: Java Heap Space error in OSX
          Gary Graham-Oracle

          Hi Kirk,


          Your options are ...

          • As you say, do not "Show query results in new tabs", or close some tabs manually before the product locks up.
          • Disconnect the connection before the product locks up / avoid multiple connections.
          • Put an "AddVMOption  -Xmx1024M" line in your sqldeveloper-Darwin.conf, where the new memory limit exceeds the 800M default value in the ide.conf file.
          • Reduce the value for Tools - Preferences -> Database -> Advanced -> Sql Array Fetch Size




          • 2. Re: Java Heap Space error in OSX
            Kirk Fritsche



            Thanks for the info about the VMOption, I wasn't aware of that and the increase should extend the usefulness of sqldeveloper.

            It still feels like a bug in sqldeveloper that should be fixed.




            • 3. Re: Java Heap Space error in OSX

              You're asking for a lot of resources. Eventually you'll consume them. If you want to do more, get more.


              The ability to proactively monitor the JVM for memory availability and to get more as needed isn't currently feasible, but would be welcomed. Is this what you're asking for, when you call this behavior a 'bug?'

              • 4. Re: Java Heap Space error in OSX
                Kirk Fritsche

                I understand the resource request is quite large and I'm fine with the limits.

                Having the historical query result tab is too useful to turn off for the rare case where I need to query such a large result.

                Proactive monitoring of memory and prediction of how much memory might be needed sounds like an expensive process and would likely be prone to error, so no definitely not.


                What I was considering bug behavior was the seemingly unhandled out of memory error.

                The message "Java heap space" is displayed, but after that point sql developer is unstable.

                Any further interaction with that connection will cause sql developer to go into an unresponsive state.

                Interactions on any other connection seem to work just fine, so long as this one is not used.

                Currently when this error shows up I immediately save off all my files and perform a "force quit".

                I would rather be able to, or automatically have, the connection terminated and all associated resources freed up so my other connections can continue on.