Scala plugin holding large amounts of memory for closed projects
Migrated from http://lampsvn.epfl.ch/trac/scala/ticket/2965
Reporter ijuma
I use a heap of 2GB, but even so it doesn't take too long before I have to restart Eclipse because the garbage collections are unable to free any memory.
The memory usage was at about 1.5 GB when I closed all the projects and invoked the garbage collector. That didn't help much, so I took a heap dump. I'm attaching the exported csv.
Reporter ijuma
I use a heap of 2GB, but even so it doesn't take too long before I have to restart Eclipse because the garbage collections are unable to free any memory.
The memory usage was at about 1.5 GB when I closed all the projects and invoked the garbage collector. That didn't help much, so I took a heap dump. I'm attaching the exported csv.
Leave a comment
on 2010-01-25 21:09 *
By tracImporter
Trac author: ijuma
Attachment: file:eclipse-heap-dump.csv.bz2
A heap dump taken on an Eclipse instance with all projects closed.
Attachment: file:eclipse-heap-dump.csv.bz2
A heap dump taken on an Eclipse instance with all projects closed.
on 2010-01-25 21:19 *
By tracImporter
Trac author: ijuma
A bit of analysis:
A bit of analysis:
- There are 12 ScalaProject instances, which match the number of scala projects in my workspace.
- I opened one of them and looked at the path to GC root and it's a org.eclipse.ui.internal.EditorHistory that eventually holds a InternalClassFileEditorInput than in turns references ScalaClassFile that finally references ScalaProject.
- The memory used by ScalaProject is pretty much all in EclipseBuildManager.
- A large part of the latter is in the compiler where intersectionWitness and uniques are worth looking at.
on 2010-01-25 21:42 *
By
Each open Scala project will have two instances of the compiler associated with it, one for the presentation compiler and one for the build compiler, so I think that (with the projects open) this behaviour is expected and any excessive heap use is a generic compiler issue.
However, those compiler instances shouldn't be retained when the project has been closed ... I'll look into that part of the issue ASAP.
I would also be interested to know more about your Scala projects. A 2GB heap is comfortable for working with the Scala compiler and IDE projects, and 1.5GB would be adequate. Can you give me some rough feel for the size of your 12 projects jointly relative to that as a baseline? It could be that you really do need that much (or more) heap.
However, those compiler instances shouldn't be retained when the project has been closed ... I'll look into that part of the issue ASAP.
I would also be interested to know more about your Scala projects. A 2GB heap is comfortable for working with the Scala compiler and IDE projects, and 1.5GB would be adequate. Can you give me some rough feel for the size of your 12 projects jointly relative to that as a baseline? It could be that you really do need that much (or more) heap.
on 2010-01-25 21:59 *
By tracImporter
Trac author: ijuma
Yes, I understand that the issue is with memory usage is more of a generic compiler issue. I just added the details since I had the heap dump already.
I filed this for the closed projects issue indeed.
These 12 projects have about 50k lines of Scala in total, so it seems a bit excessive to need more than that, but it's possible. Another datapoint is that after building all the projects and invoking GC, about 1GB is used. As time goes on, this grows to the point where everything is used. This also happened with 2.7.x and is the kind of symptom that indicates a cache that grows without bounds somewhere.
In any case, I'll try a 2.5GB heap and see how that fares.
By the way, thanks for the quick attention to these issues. :)
Yes, I understand that the issue is with memory usage is more of a generic compiler issue. I just added the details since I had the heap dump already.
I filed this for the closed projects issue indeed.
These 12 projects have about 50k lines of Scala in total, so it seems a bit excessive to need more than that, but it's possible. Another datapoint is that after building all the projects and invoking GC, about 1GB is used. As time goes on, this grows to the point where everything is used. This also happened with 2.7.x and is the kind of symptom that indicates a cache that grows without bounds somewhere.
In any case, I'll try a 2.5GB heap and see how that fares.
By the way, thanks for the quick attention to these issues. :)
on 2010-01-25 22:07 *
By
It would be interesting to know the incremental cost of each additional Scala project ... if you have time it would be nice to see heap usage data for 1..n minimal Scala projects.
on 2010-01-26 09:58 *
By tracImporter
Trac author: spiros
CC Change: sptz45@…
CC Change: sptz45@…
on 2010-02-06 22:22 *
By tracImporter
Trac author: Villane
CC Change: villane@…
CC Change: villane@…
I finally had a chance to check the incremental cost of each additional Scala project. The memory reported is always after a GC.
Start Eclipse -> 108M
Open a Scala project with 1 file -> 151M
Open another Scala project with 1 file -> 181M
Open another Scala project with 0 files -> 181M
Open another Scala project with 1 file -> 210M
Open another Scala project with 2 files -> 240M
Open another Scala project with 1 file -> 267M
All projects were very small as indicated by the number of files. Tested with r21862.
Start Eclipse -> 108M
Open a Scala project with 1 file -> 151M
Open another Scala project with 1 file -> 181M
Open another Scala project with 0 files -> 181M
Open another Scala project with 1 file -> 210M
Open another Scala project with 2 files -> 240M
Open another Scala project with 1 file -> 267M
All projects were very small as indicated by the number of files. Tested with r21862.
Updating tickets (#1000069, #1000195, #1000213, #1000223, #1000006, #1000021, #1000038, #1000048, #1000051, #1000052, #1000075, #1000103, #1000109, #1000115, #1000119, #1000156, #1000186, #1000207, #1000238, #1000262, #1000263, #380, #389, #683, #1238, #1331, #1635, #1645, #1715, #1729, #1744, #1783, #1839, #1869, #1885, #1890, #1902, #1918, #1919, #1924, #1925, #1946, #1964, #1991, #2131, #2233, #2342, #2348, #2408, #2459, #2499, #2523, #2572, #2582, #2602, #2614, #2615, #2675, #2710, #2745, #2763, #2816, #2830, #2834, #2878, #2879, #2887, #2888, #2901, #2911, #2912, #2922, #2937, #2938, #2942, #2951, #2955, #2957, #2961, #2964, #2965, #2974, #2975, #2989, #2990, #3002, #3055, #3070, #3087, #3135, #3139, #3173, #3182, #3184, #3200, #3213, #3214, #3221, #3243, #3251)
on 2014-10-20 13:42 *
By Iulian Dragos
Eclipse version set to Luna - Eclipse 4.4
Version set to 3.0.4-211
Status changed from New to Won't Fix