Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#3371 closed Enhancement (fixed)

Use F_NOCACHE to reduce the growth of Inactive Memory on OS X

Reported by: charles Owned by: charles
Priority: Normal Milestone: 2.02
Component: Mac Client Version: 2.01
Severity: Normal Keywords:
Cc:

Description (last modified by charles)

This is a perennial topic for Transmission's mac users. What's happening is that OS X caches -- at the OS level, not at the Transmission level -- the contents of files that we download and seed. This is left as "Inactive Memory" by the OS so that, if needed later, those file's contents can be retrieved without requiring another disk read.

Unfortunately, many people see this as a memory leak, and there is anecdotal evidence that excessive Inactive Memory can make the sysem more sluggish. Apple's documentation says Inactive Memory is a Good Thing and to not worry about it. Unfortunately, I have never seen anyone who reported this issue to be persuaded by Apple's explanation. :)

fcntl(F_NOCACHE) is an OS X mechanism to give the OS a hint that we don't want it to cache a file. By using this on files we seed, we should be able to reduce the amount of Inactive Memory that Transmission generates.

This was tried once before in 1.50, but was removed in 1.60 due to user reports in ticket #1967 that indicated that the iowait was too high without caching. However now that prefetching's been added in Transmission 1.90, it's worth trying F_NOCACHE again to see what effects it has on performance and memory use.

Attachments (1)

0001-Discard-data-from-the-kernel-cache-as-soon-as-possib.patch (2.6 KB) - added by jch 13 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 13 years ago by charles

r10901 libtransmission/fdlimit.c: (trunk libT) #3371 "experimental use of F_NOCACHE to ameliorate inactive memory on OS X" -- disable caching on OS X

comment:2 Changed 13 years ago by r0n1n

I've been running r10901 for about two days, and my inactive memory hasn't increased dramatically like it did with previous builds. I've also noticed that OS X is a little bit snappier. I think older builds were causing OS X to run a little sluggish. Thank you for adding F_NOCACHE. r10901 is running great. :)

Last edited 13 years ago by r0n1n (previous) (diff)

comment:3 Changed 13 years ago by charles

  • Description modified (diff)
  • Status changed from new to assigned
  • Summary changed from Experimental use of F_NOCACHE to ameliorate inactive memory on OS X to Use F_NOCACHE to reduce the growth of Inactive Memory on OS X

comment:4 follow-up: Changed 13 years ago by jch

Here's a port of the above to POSIX systems. Completely untested.

Note that I hold no opinion on whether it should be applied.

--jch

Last edited 13 years ago by jch (previous) (diff)

comment:5 follow-up: Changed 13 years ago by jch

Charles, looking at r10901 again -- do you know for a fact that F_NOCACHE doesn't have the effect of disabling prefetching? I'd expect prefetching not to make sense for an uncached file.

--jch

comment:6 in reply to: ↑ 5 Changed 13 years ago by charles

Replying to jch:

Charles, looking at r10901 again -- do you know for a fact that F_NOCACHE doesn't have the effect of disabling prefetching? I'd expect prefetching not to make sense for an uncached file.

Nope, no idea. The documentation on this is very sparse and I can't test it firsthand. All I did was commit the change and now I'm waiting for user feedback.

comment:7 in reply to: ↑ 4 Changed 13 years ago by charles

Replying to jch:

Here's a port of the above to POSIX systems. Completely untested.

Note that I hold no opinion on whether it should be applied.

So far only Mac users are complaining about it.

comment:8 Changed 13 years ago by charles

https://forum.transmissionbt.com/viewtopic.php?f=1&t=10208&p=47915#p47915

I've been using the nightly build for 2 days now and it has been awesome, inactive memory doesn't grow out of control and the system never seems to lose it's snappiness. Before when I would Finish downloading a 4gig or so size file, I usually just let it chug along overnight, the system would be beachballing everywhere and even Apps that were already open would take a minute to load. Now everything is running like it should. I also haven't noticed transmission running any slower with it not catching the data; seems to me like prefetching in transmission is alive and working well in this build. Overall I'm really impressed with this build!

comment:9 Changed 13 years ago by charles

  • Milestone changed from 2.10 to 2.02

backported to 2.0x by r10928

comment:10 Changed 13 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:11 Changed 13 years ago by charles

  • Component changed from libtransmission to Mac Client

...because "all platforms" doesn't quite fit. :|

Note: See TracTickets for help on using tickets.