question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OOM while loading classpath with large JAR files

See original GitHub issue

Hi team, thank you for making this awesome lib!

So I’m working on a project to generate a graph for dependencies downloaded by a specific Gradle build.

I managed to write a plugin for Gradle and get all JARs associated with a project once build is finished, and then call ClassGraph’s scan function within the plugin, and using overrideClasspath to point classpath to all JARs.

While these JARs are being necessary to generate a complete graph, the entire size of those JARs could be extremely large (2GB+). Which leads to Gradle to raise OOM exception since the heap is exhausted.

I’m wondering what’s the best practice to deal with this kind of situation where the JARs are very large? Is that possible for ClassGraph to process chunk by chunk?

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:57 (27 by maintainers)

github_iconTop GitHub Comments

1reaction
JBrVJxsccommented, Apr 27, 2019

@lukehutch Wow, thank you so much for all the great suggestions and even their improvements. I’ve read each line of your code and I know exactly what you are trying to accomplish, and they totally make sense and would work!

1reaction
johnoucommented, Apr 24, 2019

@laonawuli can you provide a heap dump?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jar files loading in memory - Oracle Communities
1. Are the jar files specified in classpath of a java program loaded in memory at the jvm startup ? No. Only class...
Read more >
Including all the jars in a directory within the Java classpath
JAR . For example, the class path entry foo/* specifies all JAR files in the directory named ... rather than late, during the...
Read more >
Classloader-Releated Memory Issues - Dynatrace
Each class was quite large and memory-hungry. Due to a coding error the application was loading not just one, but every language class...
Read more >
Cache performance - IBM
When a class is loaded from the shared class cache, the stored classpath and the class loader classpath are compared. The class is...
Read more >
Java Guide: How to Fix "Could not find or load main class"
The class being declared in the incorrect package. · The file path of the class not matching the fully qualified name. · Incorrectly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found