cewolf memory leak problem

  • mesanchez

    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:


        showlegend="false" >
        <cewolf:plot type="<%=graphType%>">
                            <cewolf:producer id="myDataProducer" />
       <cewolf:colorpaint  color="#FFFFFF"/>

       <cewolf:chartpostprocessor id="myDataProducer" />

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


    When these lines are removed:

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

    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:


    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.


  • Michael Fields
    Michael Fields

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


    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.