From: Alan W. I. <ir...@be...> - 2002-12-10 21:43:40
|
On Tue, 10 Dec 2002, Joao Cardoso wrote: > > Actually, with sunos, memory had to be specifically released by the > > programme. > > Hard to believe! sunos is unix. Unless you are talking of shared memory, as in > that case the shared memory will stay (usable by other processes) in the > system, even when the program who allocate it exits. It must be explicitly > released. I was probably talking about shared memory.....(with my further questions about this carried on privately). > > 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?) > > remember to not polute the API. We should be carefull with this issue. I think > that plinit/plend1 will be fine. Good. > Also, our library does not has a specific entry point to initialize it, 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 memory that was allocated as part of the library initialization > This is a difficult problem to solve, releasing all allocated memory. For > example, when one use strdup(), or our plstrdup() version, we might lost 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. So has a consensus been reached here to use plend for this library memory release task with appropriate plend =>plend1 adjustments to the x octave scripts? Alan |