Hi Revathi,
Drawing a pie chart will not take more memory compared to drawing any other chart. In
fact, we think it should be using less memory compared to other charts. In any case, the
amount of memory required is not big and mainly depends on the number of pixels. Unless
you are drawing a chart with 100000 x 100000 pixels (which is much much bigger than a
typical computer screen), it will not take significant memory.
Another part of the chart that needs memory is the image map (for tooltips and clickable
hot spots). However, unless your pie chart has 100000 sectors (therefore has 100000
tooltips and clickable regions), it is unlikely the image map would take significant memory.
From your previous message, you seem to be using the .NET framework. The .NET
framework relies on automatic garbage collector to free memory. Suppose you create and
display a chart, and then create and display another chart which replaces the first chart,
the .NET framework should automatically release the memory of the first chart during its
garbage collection cycle. So unless you own code explicitly keep the old charts in
memory, in theory they should not cause out of memory issues. If the system does not
run out of memory initially, it should not run out of memory "eventually" as the .NET
should automatically release the old charts and reclaim the memory.
For your case, are your code creating exceptionally large charts (like 100000 x 100000
pixels) or using exceptionally large font size (like Arial font of 10000pt in size), or are you
code creating a lot of charts but somehow keep them in memory (by keeping references
to the charts), which prevents the garbage collection to reclaim the memory?
If you are creating charts in a fast rate, may be you can try to run the line
"System.GC.Collect()" once every 10 charts. This line is to ask the .NET framework to
perform garbage collection immediately, just in case the .NET framework for some reasons
do not reclaim memory frequently enough.
Regards
Peter Kwan |