Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Re: OutOfMemory debugging in Eclipse

I was able to get rid of that out of memory though the root cause is
not yet clear for me.

As you might noticed, I was creating units based on the file names
I've got from IIndex. So, I was locking the index for entire set of
the files and was releasing it at the end.
With the mat tool I've found that fResultCache has the biggest size.
After some debugging, I've realized that I need to release the index
once I had finished with the particular file.
That is working fine.
Nevertheless, the root cause is still unclear for me. I have to say
that the program I'm developing can use both ways to deal with the
code: index and/or AST. It is amazing that when it uses index only,
there is no Out Of Memory! This error hapens only if I'm using AST. If
program cannot get AST unit (I've got couple files with
StackOverflowError), it falls back to index usage (for this particular
file only! Next files are parsed by AST). Soon after that, Out Of
Memory happens.

Dmitry

2008/10/9 Dmitry Smirnov <divis1969@xxxxxxxxx>:
> Hi,
>
> with the help of http://www.eclipse.org/mat/ I had detected that the
> problem is caused by the huge size of
> org.eclipse.cdt.internal.core.pdom.WritablePDOM object.
> Unfortunately, the hprof file, generated by JVM is very big (about 540
> MB; JVM was configured to run application with 512 MB). Even ZIPped it
> is about 150 MB.
> If I increase the size (I've tried 768 and 1024 MB), the problem persists.
> So, I'm suspecting memory leak and need you advice how to find the root cause.
>
> Let me describe the algorithm I'm using to parse the code.
> First, I'm creating a project and configure its source and include directories.
> Second, I start the indexer and wait for it to complete. Indexer
> creates the .pdom file which is about 60 MB.
> Third, for each indexed file, I'm creating an ASTTranslationUnit and
> use it to find functions, macro, references to other functions from
> the function body (with the help of Visior pattern), references to
> function from the other files.
> The information is stored in org.w3c.dom.Document and it does not
> contain refernces to index, AST or similar objects. Only strings
> (function, macro names), numbers (source line).
>
> Indexer had processed about 2400 files. Depending on the order (I can
> reaarange this order before processing files in my application) and
> the size of heap, the OutOfMemoryError can happen after parsing from
> 200 to 500 files.
>
> What could be the reason for such growth?
>
> BTW, I've noticed that the getIndex() of my ASTTranslationUnit returns
> null. Is it correct? Can I instruct AST to use PDOM generated
> previously?


Back to the top