Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Getting sources for a (bundle) JarPackageFragmentRoot
Getting sources for a (bundle) JarPackageFragmentRoot [message #802047] Sun, 19 February 2012 10:01 Go to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 289
Registered: July 2009
Senior Member

HI,

I'm struggling with IPackageFragmentRoot API.

For each IPackageFragementRoot in my workspace, I'd like to analyze all IClassFiles and ICompilationUnits. For each, I requested the AST from SharedAstProvider.getAST(ITypeRoot,..) which worked but was slow and consumed all memory over time until eclipse became unresponsive.

Is there a better way to perform this kind "loading all types in a project" that does not fill up Eclipse's memory completely?


Thanks,
Marcel
Re: Getting sources for a (bundle) JarPackageFragmentRoot [message #802260 is a reply to message #802047] Sun, 19 February 2012 17:46 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 289
Registered: July 2009
Senior Member

Seems like calling close() on IClassFiles, IPackageFragments and IPackageFragmentRoots frees enough memory.

JDT and GC is working hard Wink

index.php/fa/7219/0/
Re: Getting sources for a (bundle) JarPackageFragmentRoot [message #803602 is a reply to message #802047] Tue, 21 February 2012 14:58 Go to previous message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 2/19/2012 3:31 PM, Marcel Bruch wrote:
> I'm struggling with IPackageFragmentRoot API.
>
> For each IPackageFragementRoot in my workspace, I'd like to analyze all
> IClassFiles and ICompilationUnits. For each, I requested the AST from
> SharedAstProvider.getAST(ITypeRoot,..) which worked but was slow and
> consumed all memory over time until eclipse became unresponsive.
>
> Is there a better way to perform this kind "loading all types in a
> project" that does not fill up Eclipse's memory completely?

In JDT/UI we have to create ASTs for a bunch of types for 'Clean-up'
operations, there we use
org.eclipse.jdt.internal.corext.dom.ASTBatchParser to create ASTs in a
batch as opposed to one by one.

Creating ASTs in a batch is definitely better in terms of performance,
but I don't know how much better.

Disclaimer: You may run into out of memory errors in some cases. I know
at least one open bug for this
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337514

--
Deepak Azad
http://wiki.eclipse.org/JDT/FAQ
Previous Topic:Open Type & keep position within file
Next Topic:Why does printing parent node of a node returns parent + child nodes?
Goto Forum:
  


Current Time: Thu Apr 25 10:31:30 GMT 2024

Powered by FUDForum. Page generated in 0.03813 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top