Bye, Bye, DOM parser in Plugin Manager
By Rechtacek's on Aug 12, 2008
NetBeans teams are in fixing and stabilization phase of upcoming release NetBeans 6.5. The modules Autoupdate (API) and Plugin Manager (UI) are in step of fixing as well. After most of functional bugs have been fixed in previous milestones of NetBeans, I'm targeting the performance area in these modules.
One of most reporting problems is a high memory consumption while parsing content of Update Centers. Because usually content of Update Center is represented in XML structure, Plugin Manager used DocumentBuilder to get DOM document and processing DOM Nodes. This way was easy and elegant but due to having many many modules in NetBeans codebase which made XML file too big, creating and processing that Document consumption too big memory, commonly 60-70MB on memory heap. Even though such big memory is allocated temporary and will return back to JVM, it could cause OutOfMemoryException sometimes.
Since NetBeans 6.5 (but not in NetBeans 6.5 Beta!) Autoupdate/Plugin Manager don't use DOM document for processing such XML files, uses SAX parser which is lighter and asks less memory to handling XML elements. By my memory measuring the Plugin Manager the memory consumption decreased to 30MB on the heap, it means 50-60%. It's not bad although it might have been better
Stay tuned, more performance improvements have been integrated in NetBeans 6.5 Beta (coming soon) and some else are planning for fixing phase of NetBeans 6.5 after beta too.