Skip to content

Surelog (library) leaks memory. #3661

@mglb

Description

@mglb

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

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