Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surelog (library) leaks memory. #3661

Open
mglb opened this issue May 17, 2023 · 1 comment
Open

Surelog (library) leaks memory. #3661

mglb opened this issue May 17, 2023 · 1 comment
Assignees

Comments

@mglb
Copy link

mglb commented May 17, 2023

Surelog, at least when used as a library, has significant memory leaks.
First discovered in systemverilog-plugin, but later verified with basic Surelog examples (e.g. hellouhdm).
Brief look at logs tells that leaking memory is being allocated in both Surelog and UHDM.

Build

# export CXX='clang++'
# cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
    -DCMAKE_CXX_FLAGS="-gdwarf-4" \
    -S . -B build
# cmake --build build -j $(nproc)

(-DCMAKE_CXX_FLAGS="-gdwarf-4" is for Valgrind compatibility when compiling with Clang 15+)

Run

# cd build/bin
# valgrind ./hellouhdm ../../tests/UnitElabBlock/top.v

Result:

...
==2== HEAP SUMMARY:
==2==     in use at exit: 6,839,877 bytes in 94,007 blocks
==2==   total heap usage: 1,443,800 allocs, 1,349,793 frees, 98,733,639 bytes allocated
==2==
==2== LEAK SUMMARY:
==2==    definitely lost: 66,818 bytes in 276 blocks
==2==    indirectly lost: 401,047 bytes in 2,469 blocks
==2==      possibly lost: 0 bytes in 0 blocks
==2==    still reachable: 6,372,012 bytes in 91,262 blocks
==2==         suppressed: 0 bytes in 0 blocks

Second run, with already generated preprocessing data (slpp_all):

==2== HEAP SUMMARY:
==2==     in use at exit: 4,613,893 bytes in 69,870 blocks
==2==   total heap usage: 206,939 allocs, 137,069 frees, 17,785,433 bytes allocated
==2==
==2== LEAK SUMMARY:
==2==    definitely lost: 68,066 bytes in 275 blocks
==2==    indirectly lost: 399,799 bytes in 2,470 blocks
==2==      possibly lost: 0 bytes in 0 blocks
==2==    still reachable: 4,146,028 bytes in 67,125 blocks
==2==         suppressed: 0 bytes in 0 blocks
@alaindargelas
Copy link
Collaborator

Antlr is responsible for most of the leaks.
UHDM memory leaks is going to be solved with the Garbage collection WIP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants