|
From: Alan W. I. <ir...@be...> - 2002-12-10 16:44:43
|
On Tue, 10 Dec 2002, Joao Cardoso wrote: > [...]The problem is an user program finish doing a plot, > and thus closing the plot using plend(). Latter on, in the same program, > another plot is needed, thus plinit() is again called. > The x??c examples all finish with plend(), thus the octave counterparts also > do the same. But *one* instance of Octave wants to run *all* x??c demos, thus > the several plinit/plend. > > I often do that in Octave, closing a plot figure, opening another, ... and all > users of interactive languages certainly do the same. Of course, I could use > plinit/plend1(), I woke up this morning with this same idea. Maurice, would that work (if the interactive user always stuck with plend1 and never called plend)? I assumed it would even with default stream 0, but you introduced the interesting topic of stream 0 class versus stream >0 instance, and now I don't know whether that is a separate issue or not....;-) > I never bother releasing memory that will be relased anyway by the OS when a > program finish. At least in unix, when a program finish, the memory owned by > the program will be released. Actually, with sunos, memory had to be specifically released by the programme. So if you killed the programme rather than normally exiting, you never got the memory back. I had first-hand experience of this many times in the first half of the 90's and the only recourse was to reboot the system to get all the memory back if newbie users were making the mistake of killing programmes rather than letting them normally exit. Part of my prejudice against Unix (and love of Linux since it does release memory as you indicated) originates from those difficult days. Hopefully not too many unices have inherited this memory misfeature from sunos. But I know of at least one of our users, who does not have the financial resources to pay the solaris license fees, who still uses sunos! Assuming the plinit/plend1 sequence will work without ever calling plend, then the user can simply use this sequence when it is impossible to predict when the last plot will occur. Then, plend could be strictly reserved for situations where you *know* this is the last plot before exit if you care about cleaning up memory use and not relying on the OS to do it for you. (I believe this was the original intent from the way it is documented, see http://plplot.sourceforge.net/resources/docbook-manual/plplotdoc-html-0.4.1/plend.html). My own feeling is not too many of our users currently use the plinit/plend/plinit sequence so it wouldn't be too much of a burden to ask them to shift to plinit/plend1/plinit. But if this really is too much of a burden, we also have the option of adding another function (pllibfree?) to our API to systematically free all the memory that was allocated when the library was opened. I would at least like to have such a function to use in our non-interactive example programmes. I don't care whether that function is called plend or something else like pllibfree so long as we have it. Alan |