Community
cancel
Showing results for 
Search instead for 
Did you mean: 
max-divulskiy
Beginner
53 Views

Parallel Inspector find memory leaks in sample

Good afternoon.
I am beginner in TBB. Can You prompting why Parallel Inspector shows memory leak in a following example?

[bash]#include 
#include
#include

class SimpleSum
{
float* my_a;

public:

float sum;

void operator( )( const tbb::blocked_range& r )
{
float *a = my_a;

for( size_t i=r.begin(); i!=r.end( ); ++i )
sum += a;
}

SimpleSum( SimpleSum& x, tbb::split ) : my_a(x.my_a), sum(0) {}

void join( const SimpleSum& y )
{
sum += y.sum;
}

SimpleSum(float a[] ) :
my_a (a),
sum (0)
{
}
};

int _tmain(int argc, _TCHAR* argv[])
{
UINT Size = 1000;
float* Mass = (float*) _aligned_malloc(Size * sizeof(float), 16 );

for (UINT i = 0; i < Size; i++)
{
Mass = (float) i;
}

SimpleSum sf( Mass );

parallel_reduce( tbb::blocked_range(0, Size), sf );

printf("Result: %f\n", sf.sum);

_aligned_free( Mass );

return 0;
}[/bash]
Errors (level mi4):
[bash]ID		Problem	Sources	Modules	Object Size	State
P1 Memory leak parallel_reduce.h TBB_reduce.exe 140 Not fixed
P2 Memory leak parallel_reduce.h TBB_reduce.exe 80 Not fixed
P3 Memory leak parallel_reduce.h TBB_reduce.exe 40 Not fixed
P4 Memory leak parallel_reduce.h TBB_reduce.exe 60 Not fixed
P5 Memory leak parallel_reduce.h TBB_reduce.exe 80 Not fixed
P6 Memory leak parallel_reduce.h TBB_reduce.exe 80 Not fixed
P7 Memory leak parallel_reduce.h TBB_reduce.exe 80 Not fixed
P8 Memory leak parallel_reduce.h TBB_reduce.exe 100 Not fixed
P9 Memory leak parallel_reduce.h TBB_reduce.exe 112 Not fixed
P10 Memory leak parallel_reduce.h TBB_reduce.exe 56 Not fixed
P11 Memory leak parallel_reduce.h TBB_reduce.exe 56 Not fixed
P12 Memory leak parallel_reduce.h TBB_reduce.exe 56 Not fixed
P13 Memory leak parallel_reduce.h TBB_reduce.exe 112 Not fixed
P14 Memory leak parallel_reduce.h TBB_reduce.exe 112 Not fixed
P15 Memory leak parallel_reduce.h TBB_reduce.exe 84 Not fixed
P16 Memory leak parallel_reduce.h TBB_reduce.exe 112 Not fixed
P17 Memory leak task.cpp tbb_debug.dll 28 Not fixed
[/bash]
0 Kudos
2 Replies
53 Views

I have moved this question from the Intel Cilk++ Software Development Kit forum.

==
Aubrey W.
Intel Software Network Support
53 Views

If you make a right click in the line of the memory leak, you can ask for an explanation.

You know:
Right-Click in this line and choose, "Explain problem"
P1Memoryleakparallel_reduce.hTBB_reduce.exe140Notfixed