Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Memory leak?

$
0
0

Hi,

I have a C++ application which is coded this way:

  • The main program does not need much memory (just a few variables). But this main program runs a loop in which we call a function.
  • This function needs about 140 MB of memory to run. The memory is allocated in the function and then released (using RAII).

When I run this program overnight on OSX, here is the data I get from "Activity Monitor", or "top" in terms of memory consumption

  • After the first loop, the program takes 150 MB of memory
  • After 68 loops, the program takes 220 MB of memory
  • After 394 loops, the program takes 480 MB of memory

So it seems that the function, which allocates and deallocated 140 MB of memory, "leaks" about 1 MB each time it is called. In this function, the allocated objects are:

  • My own version of std::vector which I call il::Vector, il::Matrix, il::Tensor. I have used these class in other codes and they seem fine.
  • A class that calls Pardiso from the MKL. Using RAII, I take care of properly deallocating Pardiso memory before I destroy the class (using the phase -1).

I have used Pointer Checker from Intel (on a Linux workstation) and Address Sanitizer from Clang on the program (with smaller inputs though) and they don't detect anything. I don't really know what to do. Is there a way memory fragmentation is responsible for this?


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>