Skip to content

Memory leak python version #81

Closed
Closed
@Hu6li

Description

@Hu6li

Description

While we were checking to use ggwave in our project, we observed memory leaks using valgrind.

Circumstances

When ggwave is imported in a python script and run against python (valgrind enabled python version), we observed these leaks.

Steps to reproduce

  1. Download Python from the original website
    We used python version 3.9.2

  2. Compile Python using the following flags:
    ./configure --prefix=/check_ggwave/python/ --without-pymalloc --with-pydebug --with-valgrind
    make OPT=-g
    make install

  3. Creating venv using new compiled python in /check_ggwave/python/python3
    python3 -m venv .venv
    . .venv/bin/activate
    pip3 install ggwave

  4. Cloning repo of ggwave and running valgrind on test-ggwave.py:
    test-ggwave: https://github.com/ggerganov/ggwave/blob/master/tests/test-ggwave.py
    valgrind --leak-check=full --log-file="valgrind_report.txt" python test-ggwave.py

Results

For more details please execute the steps above and check your output, here is a summary:

==18560== LEAK SUMMARY:
==18560== definitely lost: 1,800 bytes in 9 blocks
==18560== indirectly lost: 568 bytes in 6 blocks
==18560== possibly lost: 790,082 bytes in 6,445 blocks
==18560== still reachable: 84,547 bytes in 18 blocks
==18560== suppressed: 48 bytes in 1 blocks

Observations

During our tests we observed that there are no leaks using the C or C++ implementation. Feel free to confirm this on your own system(s) as well.

Conclusion

Based on our analysis we suspect that the cause of these leaks lays in the way ggwave's python implementation is generated (bindings).
But this is only an assumption!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions