Parallel Inspector find memory leaks in sample

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?

#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[i];
	}

	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[i] = (float) i;
	}

	SimpleSum sf( Mass );

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

	printf("Result: %fn", sf.sum);

	_aligned_free( Mass );

	return 0;
}

Errors (level mi4):

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
1 post / novo 0
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.