Menu

cewolf memory leak problem

Help
mesanchez
2007-09-27
2013-01-13
  • mesanchez

    mesanchez - 2007-09-27

    We have built a graphing application using cewolf. It allows the user to select a set of attributes and a time range to graph statistics data. One of the features it has is AUTO-UPDATE. When this feature is selected the application will, periodically, extend the time window, retrieve the latest data from db and present a new graph.
    When this feature is turned on, the application server (Tomcat) will run out of memory after some time. The time it takes to reach OutOfMemory Exception depends on factors like: available memory, memory configuration, frequency, etc. But sooner or later it reaches OutOfMemory Excaption.
      It was found that the memory leak comes from cewolf image generation.

      The jsp used to generate these graphs includes:

    ....

    <cewolf:overlaidchart
        id="line"
        title="<%=graphTitle%>"
        type="overlaidxy"
        xaxistype="date"
        yaxistype="number"
        xaxislabel="Time"
        yaxislabel="Values"
        showlegend="false" >
        <cewolf:plot type="<%=graphType%>">
                    <cewolf:data>
                            <cewolf:producer id="myDataProducer" />
                    </cewolf:data>
       </cewolf:plot>
       <cewolf:colorpaint  color="#FFFFFF"/>

       <cewolf:chartpostprocessor id="myDataProducer" />
       
    </cewolf:overlaidchart>

    <cewolf:img chartid="line" renderer="cewolf" width="700" height="400">
    </cewolf:img>

    ....

    When these lines are removed:

    <cewolf:img chartid="line" renderer="cewolf" width="700" height="400">
    </cewolf:img>

    there is no memory leak (of course there is no image displayed but the DataGraphProducer class is exercised). Once these lines are added in the jsp we can see the  memory increasing and not been released even after Full GC's.

    I have found a document in the Internet from an user that indicates that also found that cewolf images are not removed from memory:

    "
    ...

    The second problem we faced was the increase of cewolf(s) in memory caching mechanism. By default it used "TransientSessionStorage" which caches the image objects in memory, there seemed to be some problem in cleaning up the objects, even after the rerferences were lost! So we wrote a small "FileStorage" implementation which store the image objects in the local file. And would be served as and when the request comes in. Moreover, we also implmentated a cleanup mechanism to cleanup stale images( images older than 10mins).

    ...

    "

    the entire document is available at:

    http://ezinearticles.com/?40/sec-to-500/sec&id=65578

    What recommendation can you provide in order to resolve this problem? Is there a configuration/parameter that I am not setting that creates this situation?.

    Any help is greatly appreciated.

    Thanks,
        Maria

     
  • Michael Fields

    Michael Fields - 2011-03-22

    I know this is a very old post, but I had the same problem recently and found the solution to this on coderanch here:

    http://www.coderanch.com/t/500782/open-source/OutOfMemory-when-CeWolf-JFreeChart

    The solution is to specify LongTermSessionStorage instead of TransientSessionStorage in your web.xml file and add a timeout="10" to your cewolf:img tags.  This causes cewolf to clean up these images from memory.

     

Log in to post a comment.