With few exceptions, when a process terminates, all the resources held by that process will be freed.
So if repeated runs of ancillary are presently fine in that respect, then system("ancillary &"); will be as well.
All the & means is "run in the background", which has the effect of making system() return immediately, rather than waiting for the sub-process to finish.
> The main task runs for weeks and we must be sure that there are no memory overflows etc.
Code:
$ # Find the PID of the process, change 'fox' to suit
$ ps -A | grep fox
$ # Watch the process
$ top -p 2359
Use this to spot possibly increasing trends in say memory usage over time. If memory keeps creeping up, you have a leak.
'top' is a swiss army knife kinda tool, so it pays to have a good read through the manual page.
You can
- choose the columns to display.
- run in batch mode to log to a file.
- other stuff