Qemu-kvm must release unused RES memory


I think it is abnormal when the process of qemu-kvm does not release unused resident memory .
For example, at start the virtual server qemu-kvm uses memory as: VIRT = 2322m, RES = 660m
I fill his memory running the script inside virtual server, but when memory is freed inside the container, RES= 2.0g and never had not diminished.

So it must be, or this can be changed?

kernel: 2.6.32-71.29.1.el6.x86_64

script for filling memory

#!/usr/bin/perl use strict; $|=1; my @a; my $allocated=0; my $blocksize=50; foreach my $i(1..1024){ my $time = time(); my $s = '1' x ($blocksize*1024*1024); push @a, $s; $allocated += $blocksize; print "\r$allocated Mb"; $s = $a$i-10]; # read data - from swap slow! if( time()-$time > 5 ){ print "\n$allocated Mb: Slow memory allocation\n"; last; } }