Test that MADV_DONTNEED immediately frees pages




Memory Allocator
6 years ago
6 years ago


(Reporter: Justin Lebar (not reading bugmail), Assigned: Igor Bukanov)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [MemShrink:P2])



6 years ago
In bug 670596 comment 89, Igor wrote:

> (In reply to Justin Lebar [:jlebar])
>> The stricter decommit is not needed with MADV_DONTNEED on Linux.  On Linux,
>> MADV_DONTNEED'ed pages don't count against your RSS. 
> I saw few times  on Linux that when GC decommits, say, 300, MB of pages, then RSS shrinks > just by 30-50 MB max. Does MADV_DONTNEED really works on Linux as advertised?

To which I responded:

> Perhaps not! Or perhaps its behavior is different in the browser than in the simple 
> tests I've run.  (It's also possible that 250mb of the 300mb decommitted was not in 
> physical memory.)

We can do a simple test of MADV_DONTNEED: Define MALLOC_DOUBLE_DECOMMIT in jemalloc for Linux, then modify nsMemoryReporterManager's implementation of the |resident| memory reporter so it calls malloc_purge_freed_pages() before reading the RSS on Linux, as we do on Mac.

Now open a bunch of tabs, close all but one, and record Firefox's resident size using top or some other external program.  Then open about:memory and observe if the RSS falls.

Comment 1

6 years ago
Hugh, if you run Linux, would you be interested in checking this out?
Whiteboard: [MemShrink][mentor=jlebar]

Comment 2

6 years ago
(In reply to Justin Lebar [:jlebar] from comment #1)
> Hugh, if you run Linux, would you be interested in checking this out?

I will check this. However it would be nice if the Minimize memory usage in about:memory would run the shrinking GC. I will file a bug about that.

Comment 3

6 years ago
> I will file a bug about that.

Bug 699279.


6 years ago
Assignee: nobody → igor
Whiteboard: [MemShrink][mentor=jlebar] → [MemShrink]
Whiteboard: [MemShrink] → [MemShrink:P2]


6 years ago
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.