[Libtorrent-devel] Help--mmap takes lots of memory, how to decrease it?

Jari Sundell sundell.software at gmail.com
Mon Oct 26 06:22:36 UTC 2009


On Mon, Oct 26, 2009 at 4:40 AM, Andrew Sang
<andrew.lovingtech.cn at gmail.com> wrote:
> dear all,
>     i know libtorrent use mmap() and sync() so that it let the kernel to do
> the I/O, this is a good way to decrease disk I/O. but the problem is if i
> download a large file ( like 3G), it takes large memory. and the memory
> seems it will not be free until the download is finished. and even i kill
> the process, the used memory is still large for a  while ( the used memory
> is not free as soon as i kill the process).  is there a way to decrease used
> memory while downloading? i mean, maybe i could free the MemoryChunk after
> the data is sync?

Freeing the MemoryChunk thing does not make the kernel throw out file
cache pages, you'll need to use that other msync flag. And even then
it's just a hint to the kernel.

Jari Sundell


More information about the Libtorrent-devel mailing list