Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
5116 Discussions

Does Inspector XE work with TBB application?

missing__zlw
Beginner
759 Views
It seems Valgrind doesn't work with TBB memory allocator.
How about Inspector XE? Does it detect problem using TBB memory allocators? Not false violation report?
Do I need to turn on some special settings? I am working on Linux.
Any examples on using Inspector XE with TBB application?
Thanks.
0 Kudos
4 Replies
Kirill_R_Intel
Employee
759 Views
Hello,

Yes, Intel Inspector XE supports TBB memory allocator, it should work without special settings.

Regards,
Kirill
0 Kudos
Peter_W_Intel
Employee
759 Views

I just wrote a simple tbb example, which used scalable_malloc() and forgot to use scalable_free()

[cpp]#include 
#include 
#include "tbb/scalable_allocator.h"

#define LEN_STR 1024

using namespace tbb;

int main()
{

    char *str = (char *)scalable_malloc(LEN_STR*sizeof(char));
    strcpy (str, "This is an example to use tbb scalable");
    printf ("%sn",str);

    // Forget to do "scalable_free"
    return(1);

}
[/cpp]


#source /opt/intel/composer_xe_2011_sp1.7.256/bin/compilervars.sh intel64
# icpc -g tbb_scalable.cpp -ltbb_debug -ltbbmalloc -o tbb_scalable
# source /opt/intel/inspector_xe_2011/inspxe-vars.sh
Copyright (C) 2009-2011 Intel Corporation. All rights reserved.
Intel Inspector XE 2011 (build 186554)

# inspxe-cl -collect mi3 -module-filter-mode=include -module-filter=tbb_scalable -- ./tbb_scalable
Used suppression file(s): []
This is an example to use tbb scalable

1 new problem(s) found
1 Memory leak problem(s) detected

# inspxe-cl -report problems
Used suppression file(s): []
Problem P1: Error: Memory leak
/home/peter/tbb_scalable.cpp(12): Error X3: P1: Memory leak: Allocation site: Function main: Module /home/peter/tbb_scalable

You can see one memory leak detected, allocation site is at source line #12.
So Inspector XE can detect problem using TBB memory allocators.

Regards, Peter

0 Kudos
SergeyKostrov
Valued Contributor II
759 Views
Quoting zlw
Any examples on using Inspector XE with TBB application?


If you have TBB v4.xinstalled on your system please take a look at \Examples folder. There are
24 test applications in the folderand anytest applicationcan be used with Inspector XE.

Best regards,
Sergey

0 Kudos
missing__zlw
Beginner
759 Views
Great. Thanks.
0 Kudos
Reply