Skip to content

PDE freezes after switching into the Android mode #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
codeanticode opened this issue Apr 20, 2016 · 11 comments
Closed

PDE freezes after switching into the Android mode #209

codeanticode opened this issue Apr 20, 2016 · 11 comments
Assignees

Comments

@codeanticode
Copy link
Contributor

Observed on PR3 under OS X 10.10

@codeanticode codeanticode self-assigned this Apr 20, 2016
@codeanticode codeanticode added this to the Final 3.0 release milestone Apr 20, 2016
@codeanticode
Copy link
Contributor Author

codeanticode commented May 3, 2016

After waiting for a while, the PDE is responsive again, but the following error shows up in the console (3.0.2):

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.regex.Matcher.<init>(Matcher.java:225)
    at java.util.regex.Pattern.matcher(Pattern.java:1093)
    at com.google.classpath.RegExpResourceFilter.match(RegExpResourceFilter.java:37)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:50)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:32)
    at com.google.classpath.DirectoryClassPath.findResources(DirectoryClassPath.java:90)
    at com.google.classpath.CompositeClassPath.findResources(CompositeClassPath.java:78)
    at processing.mode.java.pdex.ASTGenerator.getSuggestImports(ASTGenerator.java:3288)

Same thing happens with latest revision from Processing (0249), the error is slightly different:

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:3236)
    at java.lang.StringCoding.safeTrim(StringCoding.java:79)
    at java.lang.StringCoding.access$300(StringCoding.java:50)
    at java.lang.StringCoding$StringEncoder.encode(StringCoding.java:305)
    at java.lang.StringCoding.encode(StringCoding.java:344)
    at java.lang.String.getBytes(String.java:918)
    at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
    at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
    at java.io.File.isFile(File.java:882)
    at com.google.classpath.DirectoryClassPath$FileFileFilter.accept(DirectoryClassPath.java:34)
    at java.io.File.listFiles(File.java:1291)
    at com.google.classpath.DirectoryClassPath.listNames(DirectoryClassPath.java:62)
    at com.google.classpath.DirectoryClassPath.listResources(DirectoryClassPath.java:74)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:49)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)
    at com.google.classpath.ResourceFinder.findResources(ResourceFinder.java:46)

@Manindra29
Copy link
Member

This error is from the google classpath explorer library which is used for providing import suggestions. It's running out of memory while performing a regex match to find all possible classes that match some class in the classpath. The Android SDK definitely adds a lot more classes to its search path on top of the default pde classpath classes. I'll investigate further and report back.

@codeanticode
Copy link
Contributor Author

The only jar in the Android SDK that should be searched for classes to import is platforms-xy/android.jar, and if several platforms are available, only the currently selected one . Is there any way to specific the particular jar to include in the classpath?

@codeanticode
Copy link
Contributor Author

Just a quick update: forcing ASTGenerator.getSuggestImports() to return null regardless of the situation does in fact eliminate the UI hanging and the OutOfMemoryError. So we clearly need a way to limit the extent of search by the classpath explorer...

@codeanticode codeanticode changed the title UI freezes after canceling SDK download UI freezes after switching into the Android mode May 4, 2016
@codeanticode codeanticode changed the title UI freezes after switching into the Android mode PDE freezes after switching into the Android mode May 4, 2016
@codeanticode
Copy link
Contributor Author

A temporary workaround is to disable the "Suggest import statements" option in the Preferences.

@codeanticode
Copy link
Contributor Author

@JakubValtar adding you to this discussion. As Manindra pointed out above, this issue is due to the classpath explorer library, used by the suggest imports features. The Android SDK has too many classes, and this leads to the out-of-memory error.

@JakubValtar
Copy link
Contributor

@codeanticode Update processing to latest and try again. I did error checker overhaul (merged yesterday) and it works great for me with -Xmx256m. Problem might be that previously whole processing app class path was added to search path, which is certainly not what we wanted and for example IDEs are adding tons of stuff to class path, so some people may have experienced problems with having too much stuff there.

@JakubValtar
Copy link
Contributor

@codeanticode I fixed memory leak in AndroidEditor which was preventing closed editors to be GC'd. Might solve this. I can run more than 10 editors within 256 MB. See #215

@codeanticode
Copy link
Contributor Author

Awesome, thanks a lot! I I just run the mode using the PDE after you checker overhaul, and didn't observe the freeze so far. I will now look into the PR.

@codeanticode
Copy link
Contributor Author

The freeze is solved in 3.1, when using 3.0.x, disable the "Suggest import statements" option in the Preferences as a workaround.

@JakubValtar
Copy link
Contributor

Glad it helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants