develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu

Rasmus Tamstorf
November 19, 1999 08:18
Re: [ID 19991116.002] perl5.005_02: my_setenv() and Term::ReadLine::Gnu
Message ID:
On Fri, 19 Nov 1999, M.J.T. Guy wrote:

> Nick Ing-Simmons <> wrote
> > Thus as far as I can see unless we keep a hash of "things we malloc'ed"
> > and check for match we should not free() anything in environ.
> Exactly.    And therefore, since we don't want memory leaks, we must
> keep a hash.

You just have to be careful about that when you're embedding perl in
another application that changes the environment. One problem is that
using perl malloc to create your hash will cause all sorts of bad things,
because the enviroment ends up being allocated by perl's malloc which
prevents the embedding application (which don't use perl malloc) to do any
further putenv's. 

Another problem (which is biting me :-( is that the practice of assigning
a new value to __environ (which is what you do when you create your hash)
seems to break on IRIX 6.2 using SGI's newest compiler (7.3) :-(


Rasmus Tamstorf (  If you can dream it you can do it !
Walt Disney Feature Animation                                   - Walt Disney
----------------------------------------------------------------------------- Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About