chipsalliance / chipsalliance/Surelog
Surelog (library) leaks memory.
- Dominant language
- C++
- Stars
- 475
- Forks
- 90
- Avg merge
- 1h 39m
- Merged PRs (30d)
- 37
Description
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
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the report using the provided CMake build, then run build/bin/hellouhdm on tests/UnitElabBlock/top.v under Valgrind. Trace the reported allocations across Surelog and UHDM, including the slpp_all case. Done means the library usage no longer shows the reported leaks and both runs can be checked against Valgrind summaries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100