スポンサーサイト

上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。

SystemC-2.2とSystemC-2.3で Valgrindの結果が異なる

[Tools]Ubuntu12.04に Valgrindをインストール


せっかく Valgrindを入れたことだし SystemCでもやってみようと
思いやってみたら、2.2と2.3で結果が異なっています。
要因までは特定していませんので、どなたか分かる方は教えてください。

  • サンプルコード(sc_main.cpp)
  •  1|#include <systemc>
     2|using namespace sc_core;
     3|
     4|SC_MODULE(hoge) {
     5|  SC_CTOR(hoge)
     6|  {
     7|    SC_THREAD(T);
     8|    f = 0;
     9|  }
    10|  
    11|  int f;
    12|  void T(){
    13|     //処理
    14|  }
    15|  
    16|};
    17|
    18|int sc_main(int argc, char* argv[])
    19|{
    20|  hoge *uhoge;
    21|  uhoge = new hoge("uhoge");
    22|
    23|  // delete uhoge;
    24|  return 0;
    25|}

Valgrindをインストールした時に試した main.cppと同じような記述です。


SystemC-2.2での結果

==5714== Memcheck, a memory error detector
==5714== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==5714== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==5714== Command: ./main
==5714== 

             SystemC 2.2.0 --- Jan 15 2012 14:19:56
        Copyright (c) 1996-2006 by all Contributors
                    ALL RIGHTS RESERVED
==5714== 
==5714== HEAP SUMMARY:
==5714==     in use at exit: 22,176 bytes in 41 blocks
==5714==   total heap usage: 43 allocs, 2 frees, 22,700 bytes allocated
==5714== 
==5714== 7 bytes in 1 blocks are possibly lost in loss record 4 of 41
==5714==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==5714==    by 0x8053646: sc_core::sc_object::sc_object_init(char const*) (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x805394F: sc_core::sc_object::sc_object(char const*) (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x804F326: sc_core::sc_module::sc_module() (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x804A78E: sc_main (sc_main.cpp:21)
==5714==    by 0x804E504: sc_elab_and_sim (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x41904D2: (below main) (libc-start.c:226)
==5714== 
==5714== 9 bytes in 1 blocks are possibly lost in loss record 6 of 41
==5714==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==5714==    by 0x8053646: sc_core::sc_object::sc_object_init(char const*) (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x805394F: sc_core::sc_object::sc_object(char const*) (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x805448D: sc_core::sc_process_b::sc_process_b(char const*, bool, void (sc_core::sc_process_host::*)(), sc_core::sc_process_host*, sc_core::sc_spawn_options const*) (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x805E8A4: sc_core::sc_thread_process::sc_thread_process(char const*, bool, void (sc_core::sc_process_host::*)(), sc_core::sc_process_host*, sc_core::sc_spawn_options const*) (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x80597A7: sc_core::sc_simcontext::create_thread_process(char const*, bool, void (sc_core::sc_process_host::*)(), sc_core::sc_process_host*, sc_core::sc_spawn_options const*) (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x804BC36: hoge::hoge(sc_core::sc_module_name) (sc_main.cpp:7)
==5714==    by 0x804A78E: sc_main (sc_main.cpp:21)
==5714==    by 0x804E504: sc_elab_and_sim (in /home/kocha/work/systemc/test/01_SystemC_Base/015_valgrind/main)
==5714==    by 0x41904D2: (below main) (libc-start.c:226)
==5714== 
==5714== LEAK SUMMARY:
==5714==    definitely lost: 0 bytes in 0 blocks
==5714==    indirectly lost: 0 bytes in 0 blocks
==5714==      possibly lost: 16 bytes in 2 blocks
==5714==    still reachable: 22,160 bytes in 39 blocks
==5714==         suppressed: 0 bytes in 0 blocks
==5714== Reachable blocks (those to which a pointer was found) are not shown.
==5714== To see them, rerun with: --leak-check=full --show-reachable=yes
==5714== 
==5714== For counts of detected and suppressed errors, rerun with: -v
==5714== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

期待どおり、ERRORとして検出できています。


SystemC-2.3での結果

==2653== Memcheck, a memory error detector
==2653== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==2653== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==2653== Command: valgrind/.libs/lt-main
==2653== 

             SystemC 2.3.0-ASI --- Jul 13 2012 06:33:43
        Copyright (c) 1996-2012 by all Contributors,
        ALL RIGHTS RESERVED

==2653== 
==2653== HEAP SUMMARY:
==2653==     in use at exit: 105,508 bytes in 314 blocks
==2653==   total heap usage: 332 allocs, 18 frees, 3,253,228 bytes allocated
==2653== 
==2653== 18 bytes in 1 blocks are possibly lost in loss record 11 of 50
==2653==    at 0x402B9B4: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x42187D3: std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==2653==    by 0x4218AB3: std::string::_M_mutate(unsigned int, unsigned int, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==2653==    by 0x4218C41: std::string::_M_replace_safe(unsigned int, unsigned int, char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==2653==    by 0x4218CF8: std::string::assign(char const*, unsigned int) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==2653==    by 0x4092A99: sc_core::sc_object_manager::create_name(char const*) (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x4091558: sc_core::sc_object::sc_object_init(char const*) (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x4091D17: sc_core::sc_object::sc_object(char const*) (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x408DEE0: sc_core::sc_module::sc_module() (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x80496D7: hoge::hoge(sc_core::sc_module_name) (sc_main.cpp:6)
==2653==    by 0x804948E: sc_main (sc_main.cpp:21)
==2653==    by 0x408C105: sc_elab_and_sim (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653== 
==2653== 23 bytes in 1 blocks are possibly lost in loss record 15 of 50
==2653==    at 0x402B9B4: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x42187D3: std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==2653==    by 0x146B003: ???
==2653== 
==2653== 51 bytes in 1 blocks are possibly lost in loss record 24 of 50
==2653==    at 0x402B9B4: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x42187D3: std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator const&) (in /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16)
==2653==    by 0x20FF3FF: ???
==2653== 
==2653== 2,048 bytes in 256 blocks are possibly lost in loss record 37 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x411BD08: sc_dt::sc_unsigned::sc_unsigned(int) (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x412B47B: sc_core::sc_vpool::sc_vpool(int, sc_dt::sc_unsigned*) (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x40879D9: _GLOBAL__sub_I_sc_unsigned.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 4,100 bytes in 1 blocks are possibly lost in loss record 38 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x4087B33: _GLOBAL__sub_I_sc_concatref.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 5,124 bytes in 1 blocks are possibly lost in loss record 39 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x412B415: sc_core::sc_vpool::sc_vpool(int, sc_dt::sc_unsigned*) (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x40879D9: _GLOBAL__sub_I_sc_unsigned.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 6,148 bytes in 1 blocks are possibly lost in loss record 40 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x40874C3: _GLOBAL__sub_I_sc_int_base.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 6,148 bytes in 1 blocks are possibly lost in loss record 41 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x4087773: _GLOBAL__sub_I_sc_signed.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 6,148 bytes in 1 blocks are possibly lost in loss record 42 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x40878A3: _GLOBAL__sub_I_sc_uint_base.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 6,148 bytes in 1 blocks are possibly lost in loss record 43 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x4087A07: _GLOBAL__sub_I_sc_unsigned.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 8,196 bytes in 1 blocks are possibly lost in loss record 44 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x408752E: _GLOBAL__sub_I_sc_int_base.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 8,196 bytes in 1 blocks are possibly lost in loss record 45 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x40877DE: _GLOBAL__sub_I_sc_signed.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 8,196 bytes in 1 blocks are possibly lost in loss record 46 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x408790E: _GLOBAL__sub_I_sc_uint_base.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 8,196 bytes in 1 blocks are possibly lost in loss record 47 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x4087A76: _GLOBAL__sub_I_sc_unsigned.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== 12,292 bytes in 1 blocks are possibly lost in loss record 50 of 50
==2653==    at 0x402B454: operator new[](unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2653==    by 0x4087B94: _GLOBAL__sub_I_sc_concatref.cpp (in /usr/local/lib/systemc-2.3.0/lib-linux/libsystemc-2.3.0.so)
==2653==    by 0x400EEAA: call_init (dl-init.c:85)
==2653==    by 0x400EF93: _dl_init (dl-init.c:134)
==2653==    by 0x400120E: ??? (in /lib/i386-linux-gnu/ld-2.15.so)
==2653== 
==2653== LEAK SUMMARY:
==2653==    definitely lost: 0 bytes in 0 blocks
==2653==    indirectly lost: 0 bytes in 0 blocks
==2653==      possibly lost: 81,032 bytes in 270 blocks
==2653==    still reachable: 24,476 bytes in 44 blocks
==2653==         suppressed: 0 bytes in 0 blocks
==2653== Reachable blocks (those to which a pointer was found) are not shown.
==2653== To see them, rerun with: --leak-check=full --show-reachable=yes
==2653== 
==2653== For counts of detected and suppressed errors, rerun with: -v
==2653== ERROR SUMMARY: 15 errors from 15 contexts (suppressed: 0 from 0)

とこんな感じで、大量のERRORメッセージが検出されます。
コメントの deleteを外しても SystemC-2.3は同じメッセージでERROR。。。


うーん。。。不思議。。。


環境

  • Ubuntu12.04 LTS
  • gcc/g++ 4.4.0
  • Valgrind 3.70
  • Libtool 2.4.2

追記

疑問の部分を Accellera Systems Initiative Forumのほうに投げてみました。


SystemC 2.3:valgrind error


Philippさんが丁寧に教えてくれました。
擬似的エラーもあるし、「確実」にメモリリークを検出している訳ではないので、
自分で調査して判断するしかないと言われました。(適当翻訳)

関連記事

コメントの投稿

非公開コメント

プロフィール

Kocha

Author:Kocha
なんでもチャレンジ!(^o^)/
E-mail
github:Kocha
イベントカレンダー

カレンダー
07 | 2017/08 | 09
- - 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 - -
カテゴリ
OVP (4)
最新記事
最新コメント
アーカイブ
リンク
Twitter
アクセス人数
上記広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書くことで広告を消せます。