Skip to content

Opening the gnuplot failed: pipe: Too many open files #455

Open
@steppenhahni

Description

@steppenhahni

Bug category

  • bug - compilation error
  • bug - compilation warning
  • [x ] bug - runtime error
  • bug - runtime warning
  • bug - logic error

Describe the bug
Hi, I really like the library you created. I found a problem when creating a lot of plots.
If a lot of plots are created silently and then saved, matplot seems not to close the file connections.

Steps to Reproduce

My minimal working example is:

#include
#include <matplot/matplot.h>
int main() {

using namespace matplot;

for (int i = 0; i < 1000; i++) {
	std::vector<double> a = {1.0,2.0,3.0,4.0};
	std::vector<double> b = {1.0,2.0,3.0,4.0};

	auto fig = figure(true);
	fig->size(1200, 800);
	auto ax = axes(fig);
	ax -> plot(a,b);
	save("test" + std::to_string(i) + ".svg");

}

}

Output

After around 251 plots (depends on system, I think), I get this console output for all following plots:

Opening the gnuplot failed: pipe: Too many open files
Please install gnuplot 5.2.6+: http://www.gnuplot.info

Platform

  • cross-platform issue - linux
  • [ x] cross-platform issue - windows
  • [x ] cross-platform issue - macos

Environment Details:

  • OS: MacOS
  • OS Version: Sonoma 14.4
  • Compiler: g++-14 (cstd-20)
  • Compiler version:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions