Boost Users :
Subject: Re: [Boost-users] Memory deallocation concerning boost::bind, boost::asio and shared_ptr
From: Lee Clagett (forum_at_[hidden])
Date: 2016-04-28 11:24:55
On Thu, 28 Apr 2016 13:42:12 +0200
Norman Kradepohl <kradepon_at_[hidden]> wrote:
> Hi there,
> my code is allocating memory and never freeing it, even though it
> should (at least in my opinion).
> Btw.: I'm working on debian and looking at "/proc/self/status" ->
> "VmRSS" to whatch the used memory.
The C++ runtime is not required to have a 1-to-1 mapping into the OS
for new and delete calls. So in this case the shared_ptr delete calls
should be releasing the memory into the C++ runtime, which is holding
onto the memory and not releasing it the OS. Valgrind or
-fsanitize=address with newish versions of clang or gcc will provide
more accurate information on memory leaks.
If more precise control over memory management is needed, direct system
calls for acquiring and releasing memory will be necessary.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net