ePN and memory leaks

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Tue Jan 14 06:45:17 CET 2003


Dear Sir,

I am writing to thank you for your letter and say,

On Mon, Jan 13, 2003 at 08:09:03PM -0600, Ethan Galstad wrote:
> I think they memory leaks may actually be occurring in the embedded 
> interpreter itself, although I can't say for sure.

Given that there is still artefact code in the Perl core (eg the NewX() 
family of platform independent malloc() calls; the NEWSV() macro, 

" ....
id is an integer id between 0 and 1299 (used to
identify leaks).

SV*     NEWSV (int id, STRLEN len)
")

to deal with memory leaks, and the pretty 'equivocal' advice in the 
Couzins and Jenness book about embedding, this sounds pretty reasonable 
to me.

It is really unfortunate if this is a practical issue because the API is 
so slick, including among other things

   SV 'strings' with properties like Perl scalar variables instead of C 
strings;
   AVs that are Perl arrays with macros including av_pop, av_push,
av_fetch, av_store, av_unshift, av_shift.
   HVs that are Perl hashes. No need to use linked lists.

and allowing the C coder to call Perl for pattern matching or for list
operations (grep and map), or simply to call an arbitrary Perl
subroutine - this last function alone is the basis of embedded Perl
Nag/Netsaint.

In other words, all the speed and elegance of C with the power of Perl.

However, despite the caveats there are some pretty big applications that 
do this quie happily. Surely mod_perl, gnumeric, and other applications 
would have gone away if embedding was such a mixed 'success'.

If I can ever get the ideas/and or inspiration I would like to try and
code the Nag core to use HVs instead of linked lists.

>  Nagios 2.0 will 
> have an option to reload the interpreter after a predefined number of 
> calls.


> Hopefully this will "fix" the memory leak problem, even if it 
> is a bit of a hackish thing to do.

As a not very famous man (but a very clever one) once said, "Welcome to 
my world".

> 
> 

Yours sincerely.
-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en




More information about the Users mailing list