Intel® oneAPI Data Analytics Library
Community support for building compute-intensive applications that run fast on Intel® architecture.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Memory leaks with DAAL

drodrigop
Beginner
378 Views

Hi,

My DAAL libray is at 2020.1.217 version.

I have an app that uses DBSCAN algorithm to analyze data.

I have memory leaks for two reasons: Creating numeric tables and computing the algorithm.

First, I am losing memory by creating numeric tables as:

daal::data_management::NumericTablePtr table = daal::data_management::HomogenNumericTable<double>::create(array, numCols, numRows);
 
/* code */
 
table.reset();

 

After using the table, I use 'table.reset()' trying to release the resources allocated by the library.

Despite that, valgrind shows this after several other losses:

==3438== 69,664 bytes in 1 blocks are possibly lost in loss record 702 of 728
==3438== at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==3438== by 0x135B4C77: mm_account_ptr_by_tid..0 (in /opt/intel/compilers_and_libraries_2020.1.217/linux/daal/lib/intel64_lin/libdaal_core.so)
==3438== by 0x135B40D1: fpk_serv_malloc (in /opt/intel/compilers_and_libraries_2020.1.217/linux/daal/lib/intel64_lin/libdaal_core.so)
==3438== by 0xE1FEFD9: daal::services::daal_calloc(unsigned long, unsigned long) (in /opt/intel/compilers_and_libraries_2020.1.217/linux/daal/lib/intel64_lin/libdaal_core.so)
==3438== by 0x51EF8A: void Clustering::createTable<double>(double*, unsigned long, unsigned long, daal::services::interface1::SharedPtr<daal::data_management::interface1::NumericTable>&) (in /home/app)

 

Second, there is a memory leak by using the DBSCAN algorithm:

daal::algorithms::dbscan::Batch<doublealgorithmDBSCAN(eps, minNumNeighbors);
daal::algorithms::dbscan::ResultPtr result;
 
algorithmDBSCAN.setupCompute();
algorithmDBSCAN.input.set(daal::algorithms::dbscan::data, table);
algorithmDBSCAN.compute();
 
result = algorithmDBSCAN.getResult();
 
algorithmDBSCAN.resetCompute();
 
/* code */
 
table.reset();
result.reset();

 

Valgrind shows this after several other losses:

==3438== 552 bytes in 1 blocks are possibly lost in loss record 564 of 728
==3438== at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==3438== by 0x135B3FC9: fpk_serv_malloc (in /opt/intel/compilers_and_libraries_2020.1.217/linux/daal/lib/intel64_lin/libdaal_core.so)
==3438== by 0xDF2F4A8: daal::data_management::interface1::HomogenNumericTable<int>::create(daal::data_management::interface1::DictionaryIface::FeaturesEqual, unsigned long, unsigned long, daal::data_management::interface1::NumericTableIface::AllocationFlag, daal::services::interface1::Status*) (in /opt/intel/compilers_and_libraries_2020.1.217/linux/daal/lib/intel64_lin/libdaal_core.so)
==3438== by 0xE3EE28D: daal::services::interface1::Status daal::algorithms::dbscan::interface1::Result::allocate<double>(daal::algorithms::interface1::Input const*, daal::algorithms::interface1::Parameter const*, int) (in /opt/intel/compilers_and_libraries_2020.1.217/linux/daal/lib/intel64_lin/libdaal_core.so)
==3438== by 0x51C20E: daal::algorithms::dbscan::interface1::Batch<double, (daal::algorithms::dbscan::Method)0>::allocateResult() (in /home/app)
==3438== by 0xDD036DC: daal::algorithms::interface1::AlgorithmImpl<(daal::ComputeMode)1>::computeNoThrow() (in /opt/intel/compilers_and_libraries_2020.1.217/linux/daal/lib/intel64_lin/libdaal_core.so)
==3438== by 0x520890: void Clustering::searchClusters<double>(daal::services::interface1::SharedPtr<daal::data_management::interface1::NumericTable> const&, float, unsigned long, bool, daal::services::interface1::SharedPtr<daal::algorithms::dbscan::interface1::Result>&, double*) (in /home/app)

 

Feel free to check the whole valgrind's report in the attached file.

 

Thanks,

D

0 Kudos
0 Replies
Reply