From: Joao C. <jc...@fe...> - 2002-12-11 00:45:20
|
On Tuesday 10 December 2002 21:42, Alan W. Irwin wrote: > On Tue, 10 Dec 2002, Joao Cardoso wrote: =2E.. > > Also, our library does not has a specific entry point to initialize i= t, > > and thus it doesn't make much sense to have one to finish using it. > > Maurice set this up some time ago. It has not been well advertised so = I > will mention the details again. plinit (which every initialization of > plplot must go through) calls pllib_init. The first call to pllib_init > initializes the library including memory for the dynamic driver > infrastructure as well as the memory for libltdl. Thus, it makes sense= to > have a function (the very last call to libplplot) which releases the me= mory > that was allocated as part of the library initialization In that case, a pllib_end() makes sense! Symmetry is something I like (I'= m a=20 physicist...). =46rom your description, pllib_end should release the memory allocated by= =20 pllib_init. And plend should call pllib_end, as plinit calls pllib_init. = =20 > > This is a difficult problem to solve, releasing all allocated memory.= For > > example, when one use strdup(), or our plstrdup() version, we might l= ost > > the track of the allocated memory -- that's why valgrind reports > > "definitively lost fragments" > > Yes, you would have to be careful. But a start is to at least release > the libltdl memory which is easy to do. Sure. knowing that a pllib_end() exists will encourage us to not loose th= e=20 track of allocated memory. > So has a consensus been reached here to use plend for this library memo= ry > release task with appropriate plend =3D>plend1 adjustments to the x oct= ave > scripts? OK. But don't you want to accept my idea of a pllib_end()? I will only commit my changes after AT stabilizes. Joao > > Alan |