mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-15 10:30:09 +00:00
fixing memory leaks
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@501 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
95e123eef1
commit
1b8204bdb3
@ -72,7 +72,7 @@ TEST(ComplexCarrier_Test, StandardComplexImplementation)
|
||||
mag[i] = output[i] * std::conj(output[i]);
|
||||
ASSERT_FLOAT_EQ(std::norm(expected), std::norm(mag[i]));
|
||||
}
|
||||
delete output;
|
||||
delete [] output;
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +88,6 @@ TEST(ComplexCarrier_Test, C11ComplexImplementation)
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
int pos = 0;
|
||||
for (int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
{
|
||||
output[i] = std::complex<float>(cos(phase), sin(phase));
|
||||
@ -136,5 +135,5 @@ TEST(ComplexCarrier_Test, OwnComplexImplementation)
|
||||
mag[i] = output[i] * std::conj(output[i]);
|
||||
ASSERT_NEAR(std::norm(expected), std::norm(mag[i]), 0.0001);
|
||||
}
|
||||
delete output;
|
||||
delete [] output;
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ TEST(Conjugate_Test, StandardCComplexImplementation)
|
||||
<< "-length complex float vector in standard C finished in " << (end - begin)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, end - begin);
|
||||
delete input;
|
||||
delete output;
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
}
|
||||
|
||||
|
||||
@ -132,6 +132,6 @@ TEST(Conjugate_Test, VolkComplexImplementation)
|
||||
<< "-length complex float vector using VOLK finished in " << (end - begin)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, end - begin);
|
||||
delete input;
|
||||
delete output;
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ TEST(MagnitudeSquared_Test, StandardCComplexImplementation)
|
||||
<< "-length vector in standard C computed in " << (end - begin)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, end - begin);
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
}
|
||||
|
||||
TEST(MagnitudeSquared_Test, C11ComplexImplementation)
|
||||
@ -70,14 +72,15 @@ TEST(MagnitudeSquared_Test, C11ComplexImplementation)
|
||||
const std::vector<std::complex<float>> input(FLAGS_size_magnitude_test);
|
||||
std::vector<std::complex<float>> output(FLAGS_size_magnitude_test);
|
||||
struct timeval tv;
|
||||
int pos = 0;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
int pos = 0;
|
||||
|
||||
for (const auto &item : input)
|
||||
{
|
||||
output[pos] = std::norm(item);
|
||||
pos++;
|
||||
output[pos++] = std::norm(item);
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int end = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test
|
||||
@ -132,8 +135,8 @@ TEST(MagnitudeSquared_Test, VolkComplexImplementation)
|
||||
<< "-length vector using VOLK computed in " << (end - begin)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, end - begin);
|
||||
delete input;
|
||||
delete output;
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
}
|
||||
|
||||
// volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_fft_size);
|
||||
|
@ -66,8 +66,8 @@ TEST(Multiply_Test, StandardCDoubleImplementation)
|
||||
acc += output[i];
|
||||
}
|
||||
ASSERT_EQ(expected, acc);
|
||||
delete input;
|
||||
delete output;
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
}
|
||||
|
||||
|
||||
@ -121,8 +121,8 @@ TEST(Multiply_Test, StandardCComplexImplementation)
|
||||
}
|
||||
|
||||
ASSERT_EQ(expected, result);
|
||||
delete input;
|
||||
delete output;
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
}
|
||||
|
||||
|
||||
@ -131,16 +131,15 @@ TEST(Multiply_Test, C11ComplexImplementation)
|
||||
{
|
||||
const std::vector<std::complex<float>> input(FLAGS_size_multiply_test);
|
||||
std::vector<std::complex<float>> output(FLAGS_size_multiply_test);
|
||||
int pos = 0;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
long long int begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
|
||||
// Trying a range-based for
|
||||
int pos = 0;
|
||||
for (const auto &item : input)
|
||||
{
|
||||
output[pos] = item * item;
|
||||
pos++;
|
||||
output[pos++] = item * item;
|
||||
}
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
@ -212,5 +211,8 @@ TEST(Multiply_Test, VolkComplexImplementation)
|
||||
// See http://code.google.com/p/googletest/wiki/AdvancedGuide#Floating-Point_Comparison
|
||||
float expected = 0;
|
||||
ASSERT_FLOAT_EQ(expected, result[0]);
|
||||
delete [] input;
|
||||
delete [] output;
|
||||
delete [] mag;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user