java.lang.OutOfMemoryError: Java heap space

ReinerE
ReinerE Member
edited February 11, 2022 in Analytics #1
SQL Preview shows all data, but if I run the report via Excel I get this error!?!
Please help! :)
Thx!

Comments

  • mcremer
    mcremer Member
    edited December 31, 1969 #2
    <blockquote class='ipsBlockquote' data-author="'ReinerE'" data-cid="81157" data-time="1312535394" data-date="05 August 2011 - 02:09 AM"><p>
    SQL Preview shows all data, but if I run the report via Excel I get this error!?!<br />
    Please help! :)<br />
    Thx!<br /></p></blockquote>
    <br />
    We had simular problems with an report on the iServer.<br />
    <br />
    The solution is to change some settings in your Eclipse.ini where you set the perm gen space to a bit higer (its standart 256mb I think) im a fraid you need to find the right setting tho it diviates machine on machine.
    Warning No formatter is installed for the format ipb
  • ReinerE
    ReinerE Member
    edited December 31, 1969 #3
    <blockquote class='ipsBlockquote' data-author="'mcremer'" data-cid="81158" data-time="1312535813" data-date="05 August 2011 - 02:16 AM"><p>
    We had simular problems with an report on the iServer.<br />
    <br />
    The solution is to change some settings in your Eclipse.ini where you set the perm gen space to a bit higer (its standart 256mb I think) im a fraid you need to find the right setting tho it diviates machine on machine.<br /></p></blockquote>
    <br />
    Thx. For the hint Mccremer. My IT support made this: "\BIRT.exe "eclipse -vmargs -Xms512m -Xmx512m -XX:MaxPermSize=512m"<br />
    Now it works much better. (not 100%) :)
  • mcremer
    mcremer Member
    edited December 31, 1969 #4
    <blockquote class='ipsBlockquote' data-author="'ReinerE'" data-cid="81484" data-time="1313075730" data-date="11 August 2011 - 08:15 AM"><p>
    Thx. For the hint Mccremer. My IT support made this: "\BIRT.exe "eclipse -vmargs -Xms512m -Xmx512m -XX:MaxPermSize=512m"<br />
    Now it works much better. (not 100%) :)<br /></p></blockquote>
    I have been playing with the ini file as well here is mine:<br />
    <br />
    <pre class='_prettyXprint _lang-auto _linenums:0'>-vm
    C:/Program Files/Java/jdk1.6.0_26/bin/javaw.exe
    -startup
    plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
    -product
    org.eclipse.epp.package.reporting.product
    --launcher.defaultAction
    openFile
    --launcher.XXMaxPermSize
    256M
    -showsplash
    org.eclipse.platform
    --launcher.XXMaxPermSize
    256m
    --launcher.defaultAction
    openFile
    -vmargs
    #http://www.md.pp.ru/~eu/jdk6options.html
    #http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
    #http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse
    # Commenting is done under parameter what it does.
    -Dosgi.requiredJavaVersion=1.6
    ## Forces the Eclipse to run on the newest JDK
    -Declipse.p2.unsignedPolicy=allow
    ## Makes the Update policy of Eclipse more leanant to unsingd content.
    #-Dide.gc=true
    ## Forces Java to use garbage collection when idle
    #-Xss8m
    ##determines the size of the stack
    #-XX:PermSize=512m
    #-XX:MaxPermSize=512m
    ##Size of the Permanent Generation. [5.0 and newer: 64 bit VMs are scaled 30% larger; 1.4 amd64: 96m; 1.3.1 -client: 32m.]
    #-XX:+AggressiveHeap
    #-XX:+AggressiveOpts
    #-XX:+UseParallelOldGC
    #-XX:ParallelGCThreads=4
    #-XX:ThreadPriorityPolicy=1
    #-Xverify:none
    #-XX:LargePageSizeInBytes=4m
    #-XX:AllocatePrefetchLines=1
    #-XX:AllocatePrefetchStyle=1
    #-XX:CompileThreshold=5
    #-XX:MaxGCPauseMillis=10
    ##A hint to the virtual machine that pause times of nnn milliseconds or less are desired. Default not set.
    #-XX:MaxHeapFreeRatio=50
    ## Maximum percentage of heap free after GC to avoid shrinking. Default 70
    -XX:+UseStringCache
    -XX:+UseFastAccessorMethods
    -XX:+UseLargePages
    -XX:+CMSIncrementalPacing
    -XX:+UnlockExperimentalVMOptions
    -XX:+UseG1GC
    -XX:+UseFastAccessorMethods
    -Dcom.sun.management.jmxremote
    -Dosgi.requiredJavaVersion=1.5
    -Xms256m
    -Xmx768m
    </pre>
    Warning No formatter is installed for the format ipb
  • This is a runtime error in Java which occurs when you allocate a new object in your application over a period of time continuously and the Garbage Collector (GC) cannot make space available to accommodate a new object, and the heap cannot be expanded further, which resulted this error.

    Therefore you pretty much have the following options:

    • Find the root cause of memory leaks with help of profiling tools like MAT, Visual VM , jconsole etc. Once you find the root cause, You can fix this memory leaks.
    • Optimize your code so that it needs less memory, using less big data structures and getting rid of objects that are not any more used at some point in your program.
    • Increase the default memory your program is allowed to use using the -Xmx option (for instance for 1024 MB: -Xmx1024m). By default, the values are based on the JRE version and system configuration.

    Increasing the heap size is a bad solution, 100% temporary, because you will hit the same issue if you get several parallel requests or when you try to process a bigger file. To avoid OutOfMemoryError, write high performance code:

    • Use local variables wherever possible.
    • Release those objects which you think shall not be needed further.
    • Avoid creation of objects in your loop each time.