From: Tim M. <tm...@un...> - 2012-01-05 23:51:59
|
Hi everyone, Anthony Hall and I have been discussing some memory problems that CZT has when parsing large specifications. Anthony has been trying to typecheck the iFacts specification, but without much luck due to the large memory resources. We've each been playing around with VisualVM, and Anthony pointed out is that the two largest memory hogs are Object[] and ArrayList, taking up around 23% and 10% of the heap respectively. Most of the object arrays and ArrayLists contain exactly 10 items, and almost all items in these lists are null. After some poking around, I discovered that when ArrayList is created using the default constructor, it allocates 10 items initially. This appears to be where the 10 items come from in each case. I suspect this may also be contributing to some of the memory problems, considering that CZT has so many empty annotation lists, etc. Creating ArrayLists with an initial capacity of 0 or 1 (using the constructor ArrayList(int initialCapacity)) may give us some substantial space savings It appears that most ArrayLists are created in the gnast-generated code. Petra, how difficult would it be to create these lists using this other constructor? Regards, Tim |