On Wed, Dec 20, 2017 at 09:16:46PM +0800, Yang Zhong wrote: > Since there are some issues in memory alloc/free machenism > in glibc for little chunk memory, if Qemu frequently > alloc/free little chunk memory, the glibc doesn't alloc > little chunk memory from free list of glibc and still > allocate from OS, which make the heap size bigger and bigger. > > This patch introduce malloc_trim(), which will free heap > memory when there is no rcu call during rcu thread loop. > malloc_trim() can be enabled/disabled by --enable-malloc-trim/ > --disable-malloc-trim in the Qemu configure command. The > default malloc_trim() is enabled for libc. > > Below are test results from smaps file. > (1)without patch > 55f0783e1000-55f07992a000 rw-p 00000000 00:00 0 [heap] > Size: 21796 kB > Rss: 14260 kB > Pss: 14260 kB > > (2)with patch > 55cc5fadf000-55cc61008000 rw-p 00000000 00:00 0 [heap] > Size: 21668 kB > Rss: 6940 kB > Pss: 6940 kB > > Signed-off-by: Yang Zhong <[email protected]> > --- > configure | 35 +++++++++++++++++++++++++++++++++++ > util/rcu.c | 6 ++++++ > 2 files changed, 41 insertions(+)
Reviewed-by: Stefan Hajnoczi <[email protected]>
signature.asc
Description: PGP signature
