Search code examples
memory-managementgnuplot

Gnuplot out of memory


I am working on drawing graphs with Gnuplot. The thing is as it works on, due to high memeory usage, it does not work properly, or be killed in a few minutes.

My laptops memory is 4GB. And the file size if around 1GB to 1.5 GB. Actually, I am a beginner of C language and gnuplotting. What I cannot understand is that why this 'simple-looking' work takes so many memories. It's just matching points of t and x between.

I'll write down a part of the file below. And the code I wrote down on the terminal was;

plot "fl1.dat" u 1:2 linetype 1.

1.00000e+00 1.88822e-01

2.00000e+00 3.55019e-01

3.00000e+00 -1.74283e+00

4.00000e+00 -2.67627e+00

...

...

...

Is only way I can do is add more RAM, or using computer on lab?

Thank you.


Solution

  • Another thing to note is that the choice of output terminal can have a tremendous effect on the memory consumption: interactive windows or vector formats will consume much more (I guess because these formats keep track of every single data-point, even though, as stressed by Peaceful, you probably don't need all those points). So a quick way to reduce the memory consumption may be to set the output terminal to a modestly-sized png, eg:

    set terminal png size 1000,1000
    set output "mygraph.png"