Hi all -

I'm writing a program which will start in a single process.  This
program will call init (THREAD_MULTIPLE), and finalize.  In between,
it will call spawn an unknown number of times (think of the program as
a daemon that launches jobs over and over again).

I'm running a simple example right now, and I'm seeing that the more
times I spawn, the more memory I am leaking.  Since I would ideally
have my daemon run indefinitely, a true resource leak is a big deal
for me.

Using valgrind and gdb, I've been tracing into the code.  It appears
that some of the leaks are on purpose (comments say that the memory
should never be freed).  As long as those are one-offs, it's not
really a leak, so no problems there. On the other hand, I think I've
identified some real leaks.  Many of the allocations will increase by
a factor directly proportional to the number of spawns that I call.

One example that is easy enough for me to wrap my head around is that in
orte_grpcomm_base_update_modex_entries(), there is a call made to
modex_lookup_orte_proc that will call the OBJ_NEW() macro.  The object
is inserted into a hash table, and it appears that the entry is never
cleared from the hash table.

I'm not 100% certain that the leaks are not due to my (potential)
misuse of spawn.  Upon Finalize(), I get no reports of leaked handles,
but I'm unsure if that means I've released everything that I need to
release on my side.  Is there anything that typically needs to be
paired with a spawn to clean up resources?

In my simple example, the leak is just under 4K bytes per spawn.  This
isn't huge, and the chances that the program will run long enough at
any time to go into the gigabytes is not super high; however, I'd
still feel better if this could be eliminated.

Thanks,
  Brian

Reply via email to