Skip to content

gmxapi.commandline_operation seems to have memory leaks #274

@weitse-hsu

Description

@weitse-hsu

To test the assumption that gmxapi.commandline_operation has memory leaks, I performed the following two tests:

  • Test A: Use os.system to run the GROMACS grompp for 20000 times to generate 20000 tpr files. (See Test_A.py below.)
  • Test B: Use gmxapi.commandline_operation to run GROMACS grompp commands to generate 20000 tp files. (See Test_B.py below.)

Each of the 20000 iterations in each test was timed. Both the executions of Test_A.py and Test_B.py were memory-profiled by the mprof run command (e.g. mprof run python Test_A.py) enabled by memory-profiler, which measured the memory usage every 0.1 seconds. Below I plotted the wall time per tpr generation against the number of grompp commands executed (left) the memory usage as a function of time (right).

compare_c_d

It can be seen from the figure above that memory usage increased as a function of time when gmxapi.commandline_operation was used. On the other hand, in Test A, where os.system was used, the memory usage remained roughly constant, which to my understanding is because that os.system ran the GROMACS grompp command as a separate process and the allocated memory was released once each grompp command was finished. That is, gmxapi.commandline_operation seems to have memory leaks.

I'll paste Test_A.py and Test_B.py in the next comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions