New environment for child process - how?

From: Charles Sullivan (cwsulliv_at_triad.rr.com)
Date: 01/19/04


Date: Mon, 19 Jan 2004 08:23:29 GMT

My process needs to spawn multiple child processes, each with a different
environment. As I understand it, I can do the following:
  1. Allocate memory and create the new environment array envp[].
  2. fork()
  3. execve(child_filename, argv, envp)

But here's the question:
I'm passing the new environment pointer to execve(), which doesn't return
(and which may take a long time to finish execution). But somewhere along
the line I have to free the memory I allocated for the new environment
else I'll have a memory leak.

How do I handle this situation?

Thanks for your advice.

Regards,
Charles Sullivan



Relevant Pages

  • New environment for child process - how?
    ... My process needs to spawn multiple child processes, ... Allocate memory and create the new environment array envp[]. ...
    (comp.os.linux.misc)
  • Re: C++ in the kernel
    ... M68K based STB with only 1.5 MB or flash and 1.5MB of RAM and no disks. ... What we got for that one engineers effort was a development environment ... STL is surprisingly damn useful. ... STL chunking of memory needs to be looked at, ...
    (freebsd-arch)
  • Re: Cobol data protection? Get a dog...
    ... I use win32 APIs to LOCK the memory heaps? ... This problem is universal and is not restricted to a COBOL caller. ... The submodule needs an address to do damage. ... You use the phrase 'open environment' I will let you define that so folks can ...
    (comp.lang.cobol)
  • VMWare ESX and FBSD 7.2 AMD64 guest
    ... two processors, and 8GB of memory. ... running with the exact same environment. ... I'd appreciate any feedback on tweaks that I can make (either to VMWare, ... or FreeBSD itself) to make the virtualized environment much more efficient. ...
    (freebsd-questions)
  • Re: Cool visual illusion
    ... > the environment which is important to a machine ... states (memory). ... product of our histories is a load of crock. ... It could be said that learning itself is a reward. ...
    (comp.ai.philosophy)