From: SourceForge.net <no...@so...> - 2003-09-03 08:59:35
|
Feature Requests item #788636, was opened at 2003-08-14 12:29 Message generated for change (Comment added) made by steinbeck You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=370024&aid=788636&group_id=20024 Category: None Group: None Status: Open Priority: 5 Submitted By: Chris Pudney (cpudney) Assigned to: Nobody/Anonymous (nobody) Summary: Lazy creation of ChemObject fields reduces memory overhead Initial Comment: G'day, I am working on an applet that includes a JTable that has a column displaying 2D structure diagrams (I use CDK to render the structures). It all works very nicely until the user tries to load a few thousand compounds into the applet - the result is an out of memory exception. I did some memory profiling with JMP <http://www.khelekore.org/jmp/> and jProfiler <http://www.ej-technologies.com/products/jprofiler/overview.html> and discoverd that the ChemObject class initializes many empty fields that are seldom/never used but that consume considerable amounts of memory (as they are Vectors, Hashtables or Arrays). I modified ChemObject to initialize these fields to null and delay creation of them until they are needed (lazy creation). This significantly reduced memory consumption: 3214 compounds went from consuming 156M down to 39M after implementing lazy creation. Attached is the modified ChemObject.java (& CDKConstants.java). I also reduced the initial sizes of the pointers and flags arrays and made the fields private (even subclasses should use the getter/setter methods rather than access fields directly). The unit tests all pass. Regards, Chris. ---------------------------------------------------------------------- >Comment By: Christoph Steinbeck (steinbeck) Date: 2003-09-03 10:59 Message: Logged In: YES user_id=54358 The behavior described here could almost be considered a bug. We should check if this is still the case in the current version of CDK ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=370024&aid=788636&group_id=20024 |