in reply to Re: How to reduce memory by killing redundant perl executables
in thread How to reduce memory by killing redundant perl executables

I am running Perl from an non-Perl application which you can call the parent script. From that script I launch a child script. The application is locked as long as my child script is running. As long as the child script is running the script interact with the parent script. When I run from the child script another child script I cannot use exec because then I also loose the interaction with my parent script. So I only want to kill my child script without loosing the link with my parent. When I use system it's all working fine but it builds up a lot of Perl.exe (windows2000) into the memory without releasing them.

  • Comment on Re: Re: How to reduce memory by killing redundant perl executables

Replies are listed 'Best First'.
Re: How to reduce memory by killing redundant perl executables
by Abigail (Deacon) on Jul 13, 2001 at 19:18 UTC
    Let me recap and see if I understand you right.

    You have a non-Perl application, which we will call the "parent". From "parent", you call a Perl program, which we will call "A". From "A", you call another process, called "child". From "child", you call yet another process, which we call "grand child".

    Now, "child" communicates with "parent". But now I am getting confused. You say that you do not want to lose the communication between "child" and "parent", however, you also want to kill "child". So, I am not certain which one you want to get rid of.

    You also say you lose the communication if you exec "grand child", which isn't strange because an exec replaces the current process, it being "child". So, you use system and that works fine, but it leaves running processes behind. Well, of course that "works fine". Now you are not getting rid of "child", just as I said in my previous post. Because you are doing system, "child" will wait till "grand child" is finished before executing the next statement, which happens to be the exit. So.... "child" doesn't go away until "grand child" is finished. But isn't that exactly what you want? Because if "child" goes away your communication is broken anyway....

    -- Abigail

Re{3}: How to reduce memory by killing redundant perl executables
by dragonchild (Archbishop) on Jul 13, 2001 at 19:07 UTC
    Let me see if I understand this:
    1. You have an application that isn't Perl.
    2. You run from this application some Perl script.
    3. From the Perl script, you launch another Perl script.
    4. The parent and child scripts talk to one another.
    5. At some point, you wish to be able to launch a grandchild script.
    6. This grandchild script may or may not need to be able to talk to the child script.
    *blinks* I'm going to say right now that this is starting to sound like a poorly-designed application. Without seeing your code, I'm going to bet that you are calling the grandchild script when you probably should have it as a module that you use in the child script. I'm guessing that you have these grandchildren scripts to add functionality, depending on a series of possible outcomes.

    It sounds like you may need to explore modules and redesign the way you're doing things.

    (Please note that you have given very little information about what you're doing and how it's implemented. If you know about modules and are using them, then I apologize for any insult you may feel I have given you.)