Re: Using fixed-size data buffer with GtkPlot

"Nickolai Dobrynin" <[email protected]> Mon, 27 Feb 2006 15:26:27 -0600
Newsgroups gmane.comp.scigraphica.gtkextra
Message-ID <[email protected]>
Fabio,

Thanks for your response.

On 2/27/06, Fabio da Silva <[email protected]> wrote:
>
> Hi there,
>
> I agree with Al. allocating points dynamically is not that painful or
> computer intensive.


The cost of allocating points dynamically is not what I'm worried about at
all.
My problem is far more basic and newbie-like.  Assume you allocate your
data point array dynamically and assume your program runs for days and
days uninterrupted.  Would you be OK about your system running out of
memory because you keep allocating memory on and on and on, to store
all the data points you receive at runtime, even though you only need to
plot each once and discard?  Is there no way to keep the memory usage
bounded?

However if you absolutely don't want to change the
> size of your array dynamically and are plotting points that are
> connected somehow, you will have to fill up the memory area that is not
> used with the x-y values of the latest measurement point. This is to
> avoid the annoyance of seeing the connecting line go to some random
> place in the screen after the last point is measured.  Now, realize that
> this means you will have to access the memory to write your points N*N
> times for every cycle. N is the number of points you are statically
> allocating. Soon enough you will find out that this solution will bog
> your application down quite a bit.


This sounds true, but, once again, this is not the level I am at right now.
I am asking about something that, no doubt, was done by every single
programmer who wants to plot things in real time and is not OK about the
operating system running out of memory because his data set grows
indefinitely in size.


Best regards,

Nickolai