The-OpenROAD-Project / OpenSTA

OpenSTA engine
GNU General Public License v3.0
387 stars 167 forks source link

LeakSanitizer: memory leak at OpenSTA #178

Open sheblaev opened 1 year ago

sheblaev commented 1 year ago

Hi, The memory leak is detected with simple testcase. Here is the log (cmake_san.log at testcase):

=1484234==ERROR: LeakSanitizer: detected memory leaks Direct leak of 4 byte(s) in 2 object(s) allocated from:

0 0x558b023c9d3d in operator new[](unsigned long) work/stage_2/llvm-project-15.0.7.src/compiler-rt/lib/asan/asan_new_delete.cpp:98:3

#1 0x7f52ac9b2f49 in sta::parseBusName(char const*, char const*, char const*, char, char*&, int&) work/opensta/OpenSTA/network/ParseBus.cc:85:13
#2 0x7f52ac9b2d10 in sta::parseBusName(char const*, char, char, char, char*&, int&) work/opensta/OpenSTA/network/ParseBus.cc:59:3
#3 0x7f52ad449b96 in sta::VerilogWriter::writeWireDcls(sta::Instance*) work/opensta/OpenSTA/Verilog/VerilogWriter.cc:235:9
#4 0x7f52ad4477c7 in sta::VerilogWriter::writeModule(sta::Instance*) work/opensta/OpenSTA/Verilog/VerilogWriter.cc:124:3
#5 0x7f52ad447188 in sta::writeVerilog(char const*, bool, bool, std::__1::vector<sta::LibertyCell*, std::__1::allocator<sta::LibertyCell*>>*, sta::Network*) work/opensta/OpenSTA/verilog/VerilogWriter.cc:88:14
#6 0x7f52ad2a26e7 in write_verilog_cmd(char const*, bool, bool, std::__1::vector<sta::LibertyCell*, std::__1::allocator<sta::LibertyCell*>>*) work/opensta/OpenSTA/build/CMakeFiles/sta_swig.dir/StaAppTCL_wrap.cxx:6691:3
#7 0x7f52ad3cb344 in _wrap_write_verilog_cmd(void*, Tcl_Interp*, int, Tcl_Obj* const*) work/opensta/OpenSTA/build/CMakeFiles/sta_swig.dir/StaAppTCL_wrap.cxx:37300:7
#8 0x7f52ab0cc007  (/lib64/libtcl8.6.so+0x48007) (BuildId: 09792767540eb93e60cb7e1ec20591d48a93d54f)

Please unpack the 20230703.tar.gz and use run.tcl to reproduce. 20230703.tar.gz

jjcherry56 commented 1 year ago

valgrind does not report any leaks with the latest version of opensta in https://github.com/parallaxsw/OpenSTA.git. Since the line numbers in your report do not correspond to the latest sources I suspect you have a stale repo. You should always include the commit of the version you are running when reporting a bug.