gnuplot-iostream
gnuplot-iostream copied to clipboard
Hang while streaming command on Windows
First off, thanks for this library. Awesome project!
I'm seeing a consistent hang when using gnuplot-iostream on Windows, and was hoping you could point me in the right direction to resolve it. These tend to happen when the command is very large (thousands of lines). I attached the debugger, and noticed that it stalls inside some deep boost::iostreams method, not sure if this will mean much to you:
template<>
struct write_device_impl<output> {
template<typename T>
static bool put(T& t, typename char_type_of<T>::type c)
{ return t.write(&c, 1) == 1; }
template<typename T>
static std::streamsize
write(T& t, const typename char_type_of<T>::type* s, std::streamsize n)
{ return t.write(s, n); }
};
This is in boost\iostreams\write.hpp
, and that last t.write(s,n)
call is where it seems to always hang. I tried the exact same code on Linux, and it works fine (plot takes 2 secs to generate). Any pointer will be incredibly helpful. Thank you!
Sorry, I don't think I can help here. I don't have a development environment on Windows. I suspect that it is gnuplot itself that has hung, and that your program is blocked waiting for gnuplot to finish consuming the input that has been sent so far.
Perhaps you can avoid this problem by sending less text to the gnuplot command input stream. It is possible to write the plot data to a file, and only send the commands (not the data) through the gnuplot input stream. Take a look at demo_tmpfile in example-misc.cc.
Thanks for the suggestions!