Attaching to Programs
If a program you’re testing is using too much memory, you can attach to it while it is running. You can attach to single and multiprocess programs, and these programs can be running remotely.
* 
MemoryScape requires that all programs use the MemoryScape agent. In most cases, it does this behind the scenes before the program begins executing. However, it cannot do this for an already executing program or for a core file. So, just attaching to an already running program will not provide the information you need as the agent won’t be used. In some cases, you may want to add it by starting the program using the shell env command. However, the best alternative is to link the MemoryScape agent. For details, see Linking Your Application with the Agent”.
To attach to a process, select the Attach to running program item from the Home | Add Program page.
* 
When you exit from MemoryScape, it kills all programs and processes that it started. However, programs and processes that were executing before you brought them under MemoryScape’s control continue to execute.
If you want MemoryScape to automatically attach to programs that use fork() and execve(), you must use the MemoryScape dbfork library. However, programs that you manually attach to need not be linked with this library.