Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to remove Plotchart data from memory?

45 views
Skip to first unread message

Marcos

unread,
Feb 8, 2012, 8:29:42 AM2/8/12
to
Dear,

I want to use Plotchart to plot charts for a data acquisition system
running in the laboratory for several days.

I am afraid that the great volume of data in memory can cause problems
of slowness.

How do I remove the memory data created by plotchart without having to
restart the application.

The command

package forget Plotchart

don't remove the commands of Plotchart

and after the command

namespace delete ::Plotchart

I can not load the package again with

package require Plotchart

Any suggestions?

Thanks,
Marcos

DrS

unread,
Feb 8, 2012, 9:18:21 AM2/8/12
to
On 2/8/2012 8:29 AM, Marcos wrote:
> Dear,
>
> I want to use Plotchart to plot charts for a data acquisition system
> running in the laboratory for several days.
>
> I am afraid that the great volume of data in memory can cause problems
> of slowness.
>

Will your chart also keep getting bigger? Probably not. In that case,
you'd probably only want the latest x number of data points. This should
be easy to manage and should not amount to too much memory. With each
new measurement, you just keep a list of the most recent x number of
points to plot.

Or, depending on the specifics, you can display the summary data and not
each individual measurement. Again, your vector size is limited.


DrS

Arjen Markus

unread,
Feb 10, 2012, 7:36:00 AM2/10/12
to
In addition to DrS's suggestions, I can add (as author of Plotchart)
that Plotchart itself
does not keep the data in memory - the application is responsible for
that.
A source of memory consumption could be the canvas. To deal with that:
- the "plot" method of an xy-plot (and similarly for other types)
creates individual
canvas items. These might accumulate.
- the "plotlist" method on the other hand creates a limited number of
canvas items,
but these items may have a lot of coordinates. The memory
consumption will be a lot
smaller than for the "plot" method.
- the data items have several labels - both "data" and the data series
they belong to.
You can use that to remove items when they are no longer needed
without redrawing
the plot/chart. Consult the documentation for details.

Regards,

Arjen

Donal K. Fellows

unread,
Feb 10, 2012, 8:58:09 AM2/10/12
to
On 10/02/2012 12:36, Arjen Markus wrote:
> A source of memory consumption could be the canvas. To deal with that:
> - the "plot" method of an xy-plot (and similarly for other types)
> creates individual canvas items. These might accumulate.

The item IDs will certainly leak; they're Tk_Uids under the covers.
Reuse if you can.

> - the "plotlist" method on the other hand creates a limited number of
> canvas items, but these items may have a lot of coordinates. The memory
> consumption will be a lot smaller than for the "plot" method.

Yes. Coordinate lists don't leak.

Donal.

Marcos

unread,
Feb 17, 2012, 10:16:49 AM2/17/12
to
Thanks for the informations and the indication of the command
plotlist.
Rushed to solve my problem I did not pay attention to the method
plotlist.
Marcos

Arjen Markus

unread,
Feb 19, 2012, 7:41:18 AM2/19/12
to
Well, plotlist is a relatively new one :), it is meant for speed, it
was
not designed for minimizing memory usage - that is merely a convenient
consequence.

Regards,

Arjen
0 new messages