From: Joao C. <jc...@fe...> - 2002-12-10 11:00:45
|
On Tuesday 10 December 2002 08:07, Alan W. Irwin wrote: > Apparently Joao has sequences of plinit, plend, plinit in his "x" octav= e > examples which violated an assumption I had made that a call to plend w= as > the last possible use of libplplot in a programme. With that assumptio= n I > could release libltdl memory resources in plend. I have now fixed this= so > the libtldl memory resources are never released. Now on my system all = of > Joao's "x" examples run and all his "p" examples also run except for p7= and > p15. Apparently Joao knows what the p7 trouble is so that leaves only p= 15 > as the last octave example where there is unexplained trouble. > > This is a nice step forward, but nevertheless, I am now having second > thoughts about this "fix" because I like the idea of plend being the la= st > possible call to the libplplot library so we could release all dynamic > driver (and in my case the libltdl) memory resources there. Those are = the > memory resources that are allocated when the library is initialized so = this > is the only possible place to release the resources again. But that ca= nnot > be done if our users are free to call plinit again after plend is calle= d. > > I would like to hear the developer's thoughts (especially Joao's though= ts) > on this topic. For example, there should be a way for the octave x exam= ples > to work using pladv without having to call any libplplot function after > plend is called at the very end of the x plots. I assert that because = all > the normal x examples in C are done that way so I assume octave can fol= low > that model. That is not the problem. The problem is an user program finish doing a pl= ot,=20 and thus closing the plot using plend(). Latter on, in the same program,=20 another plot is needed, thus plinit() is again called. The x??c examples all finish with plend(), thus the octave counterparts a= lso=20 do the same. But *one* instance of Octave wants to run *all* x??c demos, = thus=20 the several plinit/plend. I often do that in Octave, closing a plot figure, opening another, ... an= d all=20 users of interactive languages certainly do the same. Of course, I could = use=20 plinit/plend1(), but then, when would I call plend()? I really never know= =20 when the user has finished opening/closing plot windows or finished using= =20 Octave (*). I never bother releasing memory that will be relased anyway by the OS whe= n a=20 program finish. At least in unix, when a program finish, the memory owned= by=20 the program will be released. Joao (*)- I could register with atexit() a function that would do the cleanup,= but=20 what for? The OS does it for me. > Alternatively, there is the python or tcl model where plinit is > called once before all examples are plotted, every example restores ini= tial > values (colour maps) when its part of the plotting is done, and plend i= s > called once at the end (see xw??.py and pythondemos.tcl to see how this > approach all fits together). Could that "python" approach work for oct= ave, > Joao? > > Alan > > email: ir...@be... > phone: 250-727-2902=09FAX: 250-721-7715 > snail-mail: > Dr. Alan W. Irwin > Department of Physics and Astronomy, > University of Victoria, P.O. Box 3055, > Victoria, British Columbia, Canada, V8W 3P6 > __________________________ > > Linux-powered astrophysics > __________________________ > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Plplot-devel mailing list > Plp...@li... > https://lists.sourceforge.net/lists/listinfo/plplot-devel |