mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 04:00:34 +00:00
Fix possible memory leaks
This commit is contained in:
parent
c1e3d1bf9a
commit
f0e6d6cbfa
@ -54,32 +54,13 @@ TEST(CodeGenerationTest, CodeGenGPSL1Test)
|
|||||||
|
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||||
ASSERT_LE(0, elapsed_seconds.count());
|
|
||||||
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
|
||||||
|
|
||||||
delete[] _dest;
|
delete[] _dest;
|
||||||
/* std::complex<float>* _dest2 = new std::complex<float>[1023];gettimeofday(&tv, NULL);
|
ASSERT_LE(0, elapsed_seconds.count());
|
||||||
long long int begin2 = tv.tv_sec * 1000000 + tv.tv_usec;
|
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
|
||||||
for(int i = 0; i < iterations; i++)
|
|
||||||
{
|
|
||||||
gps_l1_ca_code_gen_complex2( _dest2, _prn, _chip_shift);
|
|
||||||
}
|
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
long long int end2 = tv.tv_sec * 1000000 + tv.tv_usec;
|
|
||||||
std::cout << "Generation 2 completed in " << (end2 - begin2) << " microseconds" << std::endl;
|
|
||||||
|
|
||||||
for (int j=0; j<1023;j++)
|
|
||||||
{
|
|
||||||
if(_dest[j] != _dest2[j]) std::cout << "Error!" << std::endl;
|
|
||||||
}
|
|
||||||
delete _dest2; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
|
TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
|
||||||
{
|
{
|
||||||
signed int _prn = 1;
|
signed int _prn = 1;
|
||||||
@ -102,29 +83,10 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
|
|||||||
|
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||||
ASSERT_LE(0, elapsed_seconds.count());
|
|
||||||
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
|
||||||
|
|
||||||
delete[] _dest;
|
delete[] _dest;
|
||||||
|
ASSERT_LE(0, elapsed_seconds.count());
|
||||||
/* std::complex<float>* _dest2 = new std::complex<float>[_samplesPerCode];
|
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
long long int begin2 = tv.tv_sec * 1000000 + tv.tv_usec;
|
|
||||||
|
|
||||||
for(int i = 0; i < iterations; i++)
|
|
||||||
{
|
|
||||||
gps_l1_ca_code_gen_complex_sampled2( _dest2, _prn, _fs, _chip_shift);
|
|
||||||
}
|
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
long long int end2 = tv.tv_sec * 1000000 + tv.tv_usec;
|
|
||||||
std::cout << "Generation completed in " << (end2 - begin2) << " microseconds (New)" << std::endl;
|
|
||||||
|
|
||||||
for (int j=0; j<_samplesPerCode;j++)
|
|
||||||
{
|
|
||||||
if(_dest[j] != _dest2[j]) std::cout << "Error!" << std::endl;
|
|
||||||
}
|
|
||||||
delete[] _dest2; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -149,8 +111,8 @@ TEST(CodeGenerationTest, ComplexConjugateTest)
|
|||||||
|
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||||
ASSERT_LE(0, elapsed_seconds.count());
|
|
||||||
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
|
||||||
|
|
||||||
delete[] _dest;
|
delete[] _dest;
|
||||||
|
ASSERT_LE(0, elapsed_seconds.count());
|
||||||
|
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user