On Tue, May 17, 2016 at 6:15 AM, Norman
In my example, the bound handlers to the *ioService* (e.g. accepting a new connection) would be freed in runtime, but the appropriate memory won't be reclaimed by the OS. So to do this manually, i found the following solution:
*Release unused heap memory under Linux in C/C++: int malloc_trim(size_t pad)*
Simplified explained, this method releases unused memory from the heap to the OS, which is exactly what i've been searching for.
Note that in the documentation there is no guarantee that this will actually do anything. A good example of where this may not have much of an effect is when the heap gets fragmented, with a small remaining in-use allocation sitting near the top of heap and unused space beneath it. While I understand the perception issue you face with your customers, in my experience you're far better in the long run to educate your customers or provide tools to show the ACTUAL memory use by your application rather than potentially thrashing the virtual memory system just to make things comport with their erroneous expectations. -- Chris Cleeland