Debug eclipse plugin project -- PermGen space, out of memory error - eclipse

I have a plugin project. When i debug this as an eclipse application, in the 2nd eclipse that opens, I want to open Project explorer window. As soon as I click on the button to do this, I get java.lang.OutOfMemoryError: PermGen space. I tried changing the PermGen space in the preference, but it did not help. Can any one please suggest a solution.

You should add the -XX:MaxPermSize=256m or 512m to the Window>Preferences>Java>Installed JREs preference page. Edit a JRE and add it to the Default VM arguments tab.
The eclipse native launcher uses the eclipse.ini to add extra permgen arguments to Oracle JVMs, but that information is not used during runtime launching.

What if you try to extend the memory of eclipse when it starts. To do that simply open the .ini file (inside your eclipse folder) and edit the lines that refer to permSize and memory size:
e.g.
-XX:MaxPermSize=500m
-Xms500m
-Xmx2000m

If you don't want to set the permgen size for EVERY launch, you can also add the Parameter to the Debug Configuration.
Run > Debug Configurations
Choose the "Eclpise Application"-Configuration on the right side and choose Arguments in the Tabs.
Add -XX:MaxPermSize=512m to the VM arguments:
-Dosgi.requiredJavaVersion=1.6 -Xms256m -Xmx4g -Dfile.encoding=UTF-8 -XX:MaxPermSize=512m

Related

CQ5 debug bundles using eclipse won't halt

I created a bundle that I already uploaded, but I would like to debug it.
I started the server with debug mode:
java
-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -XX:MaxPermSize=256m -Xmx1024M -jar AEM_6.0_Quickstart.jar
Then I set to the project that packaged into the bundle its remote debugging configuration. But when I set the breakpoints in the project, it won't halt where it needs to when the lines are executed.
Below are some steps that can be helpful. Use that command line to start your CQ instance.
java -jar cq5-author-4502.jar -fork -forkargs -- -Xdebug -Xrunjdwp:transport=dt_socket,address=59865,suspend=n,server=y -Xmx1520m -XX:MaxPermSize=512m -XX:-UseSplitVerifier
I have simple title component in which I am calling some service method. And applied some breakpoints in service. I have multi-module eclipse project practice. Setup eclipse debug configurations as shown below :
Inside source add project's module as shown below :
Click on the debug button and refresh the cq page. You will see below image:
Open the Eclipse in debug prospective you can see you variables over there and page still loading as you not complete the method execution.
Hope this will Help!!
Thanks
Replace CQ_JVM_OPTS at cq5/aem directory >> crx/bin/start
CQ_JVM_OPTS='-server -Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=30303,suspend=n'
Increase the heap size which is allocated to CQ process.
Make XX:MaxPermSize=512m and try.

How to add XX:PermSize to every run config

Recently all my runs of my java code eclipse have been giving me permMem errors.
I can fix this with adding
-XX:PermSize=128M -XX:MaxPermSize=256M
to the dun/debug config, but I don't want to keep doing this. My eclipse config has:
eclipse.vm=C:\Windows\system32\javaw.exe eclipse.vmargs=-Xms384m
-Xmx768m
-XX:MaxPermSize=384m
You can make your VM options to be shared by new run/debug launches by adding you options to Launching Arguments.
It is explained here.
Edit:
My first answer was about plug-in development, sorry about that. You can add shared vm options by:
Window->Preferences->Java->Installed JREs->Select Your JRE->Edit->Add your vm arguments to Default VM Arguments
This adds your VM arguments to your Java application run/debug configurations.

How to increase application heap size in Eclipse?

Some say I need to do that in Run Configurations for my application. When I open that window, could you please tell me how to set the right argument and the amount of memory? Say how to set 2GB or 1.5GB?
In the run configuration you want to customize (just click on it) open the tab Arguments and add -Xmx2048min the VM arguments section.
You might want to set the -Xms as well (small heap size).
Go to Eclipse Folder
Find Eclipse Icon in Eclipse Folder
Right Click on it you will get option "Show Package Content"
Contents folder will open on screen
If you are on Mac then you'll find "MacOS"
Open MacOS folder you'll find eclipse.ini file
Open it in word or any file editor for edit
...
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
...
Replace -Xms512m to -Xmx1024m
Save the file and restart your Eclipse
Have a Nice time :)
Find the Run button present on the top of the Eclipse,
then select Run Configuration ->
Arguments, in VM arguments section just mention the heap size you want to extend as below:
-Xmx1024m
In Eclipse Folder there is eclipse.ini file. Increase size -Xms512m
-Xmx1024m
Open eclipse.ini
Search for -Xmx512m or maybe more size it is.
Just change it to a required size such as I changed it to -Xmx1024m

problem in linking viewer selection with current editor - Eclipse

I often get this error "Operation linking viewer selection with current editor finished with errors" in Eclipse Galileo.
Once this error pops up no UI events is working in the IDE , i cant even able to close it also. Every time i have to go to task manager to stop the process , after this IDE works fine for some 5 min and again it display the same error as mentioned above.
i don't know what is happening , can you guys please help.
Just switch your Project Explorer to the Flat package presentation in Eclipse. It works :)
see details here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=530450#c7
Per the Eclipse manual:
PermGen is the permanent generation of objects in the VM (Class names, internalized strings, objects that will never get garbage-collected). An easy, if somewhat memory-hungry fix is to enlarge the maximum space for these objects by adding
-XX:MaxPermSize=128M
as an argument to the JVM when starting Eclipse. The recommended way to do this is via your eclipse.ini file.
If you are getting OutOfMemoryErrors while running Eclipse, the VM can be told to let the heap grow to a larger amount by passing the -vmargs command to the Eclipse launcher.
-vmargs
-Xms512m
-Xmx1024m
Alternatively, you can invoke the Eclipse executable with command-line arguments directly, as in
eclipse [normal arguments] -vmargs -XX:PermSize=512M -XX:MaxPermSize=1024M -Xmx1024M [more VM args]
Even with recent versions of Eclipse and Flat Package presentation, if you have a lot of large projects loaded this can still be a problem.
I've found however that if you break up your projects into working sets and minimise the amount of projects/tree nodes open by selecting a working set it can really speed up Eclipse and mitigate this problem.
I had this problem (Version: Photon Release (4.8.0)) and I fixed it by removing all breakpoints.

Memory Setting for OC4J in Eclipse

I've looked on the web for a while and can't seem to find the setting to increase the memory allocated to OC4J when launching from Eclipse. Does anyone know where the setting is?
Thanks.
You can add memory setting in the OC4J_JVM_ARGS environment variable. For example you could have something like:
OC4J_JVM_ARGS=-Xmx512m
You could add others if you want:
OC4J_JVM_ARGS=-XX:PermSize=256m -XX:MaxPermSize=256m -Xms1024m -Xmx2048m
Now, I never have run OC4J from Eclipse (only standalone), but you could do the same by selecting your Server view, then Open launch configuration and in the Arguments tab add the values to the VM arguments section directly like:
-Xmx512m
or
-XX:PermSize=256m -XX:MaxPermSize=256m -Xms1024m -Xmx2048m