Re: Using fixed-size data buffer with GtkPlot
"Nickolai Dobrynin" <[email protected]> Mon, 27 Feb 2006 14:29:41 -0600
| Newsgroups | gmane.comp.scigraphica.gtkextra |
|---|---|
| Message-ID | <[email protected]> |
Dear Al, Thank you very much for responding. Being a GtkExtra newbie makes it hard to ask meaningful questions, but it's newbies who need most help. On 2/25/06, Al Hooton <[email protected]> wrote: > > > I would like to be able to append points and plot them one at a time, > > which is pretty much what the 'testrealtime' example does. The > additional constraint I > > have is that, unlike 'testrealtime', I > cannot store data points in a > dynamically allocated buffer and let > > this buffer grow indefinitely. > > So, if I understand you correctly, you want to have an > ever-growing > number of points plotted, but every so often you want to throw away the > points you've already plotted and start over with a clean plot? Precisely. I need a way of telling the library: "forget everything and start over fresh BUT USE THE SAME FIXED SIZE BUFFER TO STORE DATA POINTS". Or, do you want to have an unknown number of points plotted as they > come in, but you do not want to manage the memory for them dynamically? Yes, the number of points *will* be unknown, and they *will* be plotted as they come in. All I am trying to avoid is allowing the data buffer to grow indefinitely in size. Hence the need to throw old points away and force the library to start from scratch and NOT to allocate any new memory. I just can't afford keeping the entire history around. Isn't that the most natural way to go about this? I would expect everyone who wants to plot things on the fly to want to do something similar to this. Why, indeed, would you want your plotter to keep allocating memory to store data points (to pass them to the library) and eventually make the system run out of memory? I don't seem to be able to modify the 'testrealtime' example to use a fixed, rather than dynamic, buffer to store data points and pass this buffer to the library. This is where my confusion comes from. Are my questions making more sense now? Best, Nickolai