Re: [Plplot-devel] fixed memory leak plplot-5.10.0 (Andrew Ross)

2015-03-24 Thread Phil Rosenberg
Andrew Yes that's exactly what I would do - use C++ internally, then have a C layer that interfaced outwards with error codes. I must confess to only recently realizing how amazingly useful C++ features like throwing errors and smart pointers are. But I now rely on them so much I actually genuinely

Re: [Plplot-devel] fixed memory leak plplot-5.10.0 (Andrew Ross)

2015-03-24 Thread Andrew Ross
Phil, The same thought had also crossed my mind. This is a more modern way to handle errors. You would need the C interface to catch the exceptions and return an error code since not all of our languages would handle them. This might require C++ -> C -> some thing else which is not pretty either.

Re: [Plplot-devel] fixed memory leak plplot-5.10.0 (Andrew Ross)

2015-03-23 Thread Phil Rosenberg
Yeah it's something I've been thinking about too. But not a fun task. To be honest I was starting to think that the least intrusive method would be to convert everything to C++, with a C frontend and use try-catch blocks with throw. Well I'm joking - sortof. But yes this has caused me major pain

Re: [Plplot-devel] fixed memory leak plplot-5.10.0 (Andrew Ross)

2015-03-19 Thread Jim Dishaw
On Mar 19, 2015, at 4:03 PM, Andrew Ross wrote: > On Thu, Mar 19, 2015 at 03:30:21PM -0400, Hazen Babcock wrote: >>> From: Andrew Ross >>> The attached patch fixes the memory leak for me. Pressing the close button should now behave the same as pressing 'Q', i.e. it will abort the >>

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-19 Thread Andrew Ross
On Thu, Mar 19, 2015 at 09:09:27AM -0700, Alan Irwin wrote: > On 2015-03-19 09:08- Andrew Ross wrote: > > > > >>The attached patch fixes the memory leak for me. Pressing the close button > >>should now behave the same as pressing 'Q', i.e. it will abort the > >>program and clean up correctly.

Re: [Plplot-devel] fixed memory leak plplot-5.10.0 (Andrew Ross)

2015-03-19 Thread Andrew Ross
On Thu, Mar 19, 2015 at 03:30:21PM -0400, Hazen Babcock wrote: > > From: Andrew Ross > > > >> The attached patch fixes the memory leak for me. Pressing the close button > >> should now behave the same as pressing 'Q', i.e. it will abort the > >> program and clean up correctly. It looks like this w

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-19 Thread Hazen Babcock
On 03/19/2015 03:30 PM, Hazen Babcock wrote: >> From: Andrew Ross >> >>> The attached patch fixes the memory leak for me. Pressing the close >>> button >>> should now behave the same as pressing 'Q', i.e. it will abort the >>> program and clean up correctly. It looks like this was changed at some

Re: [Plplot-devel] fixed memory leak plplot-5.10.0 (Andrew Ross)

2015-03-19 Thread Hazen Babcock
> From: Andrew Ross > >> The attached patch fixes the memory leak for me. Pressing the close button >> should now behave the same as pressing 'Q', i.e. it will abort the >> program and clean up correctly. It looks like this was changed at some >> stage in the past, but I don't know why. I guess th

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-19 Thread Alan W. Irwin
On 2015-03-19 09:08- Andrew Ross wrote: > >> The attached patch fixes the memory leak for me. Pressing the close button >> should now behave the same as pressing 'Q', i.e. it will abort the >> program and clean up correctly. It looks like this was changed at some >> stage in the past, but I do

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-19 Thread Andrew Ross
On Thu, Mar 19, 2015 at 09:08:21AM +, Andrew Ross wrote: > > > The attached patch fixes the memory leak for me. Pressing the close button > > should now behave the same as pressing 'Q', i.e. it will abort the > > program and clean up correctly. It looks like this was changed at some > > stage

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-19 Thread Andrew Ross
Great! That confirms we are looking at exactly the same bug. Thanks for the prompt response. I think I now know how to fix it. The same issue also seems to occur with the xcairo driver. Andrew On Thu, Mar 19, 2015 at 02:08:38AM -0700, Norman Goldstein wrote: > During my testing, I was using the

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-19 Thread Norman Goldstein
During my testing, I was using the close button (X) to close the window. Just now, I reran the xwin test by hitting "return" to close the window, and this produced a core dump! Thanks for looking into all this stuff. Let me know if I can help. Regards, Norm On 03/19/2015 01:56 AM, Andrew Ro

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-19 Thread Andrew Ross
> The attached patch fixes the memory leak for me. Pressing the close button > should now behave the same as pressing 'Q', i.e. it will abort the > program and clean up correctly. It looks like this was changed at some > stage in the past, but I don't know why. I guess this would allow a > program

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-19 Thread Andrew Ross
Norman, Thanks. This confirms that you are not using dynamic drivers. This explains why your fix works for you and coincides with my experiments. Just one further confirmation - were you closing the plplot window using the close button (X) on the window, or by pressing return / 'Q'? Your testing

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Norman Goldstein
Sorry, I just got back in ... OK, I certainly bow to your more extensive insight to the plplot big picture. For the record, here is how I configured plolot: cmake -DENABLE_ocaml=OFF -DCMAKE_BUILD_TYPE=Debug. -DBUILD_TEST=ON . Attached, is the cmake log. I see that the default isENABLE_DYN

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Alan W. Irwin
On 2015-03-18 23:39- Andrew Ross wrote: > I'm a little uneasy about applying this patch so late in the release cycle > in case there are any unforseen consequences. The current situation will > result in a memory leak when closing the window with the button, but since > this is on exit anyway

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Andrew Ross
On Wed, Mar 18, 2015 at 11:10:20PM +, Andrew Ross wrote: > On Wed, Mar 18, 2015 at 10:57:33PM +, Andrew Ross wrote: > > On Wed, Mar 18, 2015 at 12:59:18AM -0700, Alan Irwin wrote: > > > @Andrew: There are some really interesting release implications here, > > > and if you feel Norman's fix

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Andrew Ross
On Wed, Mar 18, 2015 at 10:57:33PM +, Andrew Ross wrote: > On Wed, Mar 18, 2015 at 12:59:18AM -0700, Alan Irwin wrote: > > @Andrew: There are some really interesting release implications here, > > and if you feel Norman's fix (ideally in git am form as I have > > requested from him below) or so

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Andrew Ross
On Wed, Mar 18, 2015 at 12:59:18AM -0700, Alan Irwin wrote: > @Andrew: There are some really interesting release implications here, > and if you feel Norman's fix (ideally in git am form as I have > requested from him below) or some other variant of it you like is a > no-brainer please go ahead and

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Alan W. Irwin
On 2015-03-18 11:05-0700 Norman Goldstein wrote: > It turns out the psc core dump was easy to fix: > Set the flag in the PLStream after closing the file > in ps.c . The three tests were good: > xwin, psc and svg > > So, I am ready to submit the updated > plcore.c and ps.c > > Perhaps, though, o

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Alan W. Irwin
On 2015-03-18 09:59-0700 Norman Goldstein wrote: > I downloaded the latest source code: > > git clone git://git.code.sf.net/p/plplot/plplot plplot.git > > Confirmed the memory leak is still in this version. > (some headache, since the debug library did not get the "d' suffix) Yes, we are dropping

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Norman Goldstein
It turns out the psc core dump was easy to fix: Set the flag in the PLStream after closing the file in ps.c . The three tests were good: xwin, psc and svg So, I am ready to submit the updated plcore.c and ps.c Perhaps, though, other devices need a fix similar to the ps.c, above. Here is the o

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Norman Goldstein
I downloaded the latest source code: git clone git://git.code.sf.net/p/plplot/plplot plplot.git Confirmed the memory leak is still in this version. (some headache, since the debug library did not get the "d' suffix) The fix eliminates this memory leak, and no others originate in plplot. Other t

Re: [Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-18 Thread Alan W. Irwin
@Andrew: There are some really interesting release implications here, and if you feel Norman's fix (ideally in git am form as I have requested from him below) or some other variant of it you like is a no-brainer please go ahead and push it (see my further comment on the release delay implications a

[Plplot-devel] fixed memory leak plplot-5.10.0

2015-03-17 Thread Norman Goldstein
I noticed that at the end of plSelectDev(), in plcore.c, a couple more fields of the PLStream needed to be filled in (feedback from valgrind :-)), so I added these two lines at line 3230: plsc->tidy = (void*) dispatch_table[dev - 1]->pl_tidy; plsc->tidy_data = (void*) plsc; I expect the