Re: [Nagios-devel] 2.0b1 on Solaris
Posted: Fri Jan 14, 2005 5:45 pm
On 14 Jan 2005 at 16:44, Andreas Ericsson wrote:
> Ethan Galstad wrote:
> > Mark Anderson submitted (un)setenv replacement code recently, but I
> > think it would be better to use the native (un)setenv() calls when
> > available and back off to putenv() when needed. I'll make a CVS
> > commit shortly with this. The putenv() call will leak memory, but
> > only in child processes, and that should get cleaned up by the OS
> > when they exit.
> >
>
> Even if ...
>
> for(i=0; environ; i++) free(environ);
> environ = NULL;
>
> ... ? It should be safe to free all of it and null it out at the end
> of execution, since symbols are already resolved.
>
> I haven't researched or tested, but perhaps extern char **environ;
> isn't
> available on all too many systems.
>
[snip]
That would probably work as well, although it may not be necessary.
The OS should clean up all memory allocated to the process and its
environment when it exits. At least, I think it should. I guess it
will require some testing.
Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
> Ethan Galstad wrote:
> > Mark Anderson submitted (un)setenv replacement code recently, but I
> > think it would be better to use the native (un)setenv() calls when
> > available and back off to putenv() when needed. I'll make a CVS
> > commit shortly with this. The putenv() call will leak memory, but
> > only in child processes, and that should get cleaned up by the OS
> > when they exit.
> >
>
> Even if ...
>
> for(i=0; environ; i++) free(environ);
> environ = NULL;
>
> ... ? It should be safe to free all of it and null it out at the end
> of execution, since symbols are already resolved.
>
> I haven't researched or tested, but perhaps extern char **environ;
> isn't
> available on all too many systems.
>
[snip]
That would probably work as well, although it may not be necessary.
The OS should clean up all memory allocated to the process and its
environment when it exits. At least, I think it should. I guess it
will require some testing.
Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]