Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 592308 - IsLowMemory() is terribly slow and there is nothing to do about it.
: IsLowMemory() is terribly slow and there is nothing to do about it.
: dev-doc-complete
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla2.0b7
Assigned To: Doug Turner (:dougt)
: Nathan Froyd [:froydnj]
Depends on:
  Show dependency treegraph
Reported: 2010-08-31 10:08 PDT by Doug Turner (:dougt)
Modified: 2010-09-08 12:39 PDT (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch v.1 (12.83 KB, patch)
2010-08-31 11:14 PDT, Doug Turner (:dougt)
benjamin: review+
Details | Diff | Splinter Review

Description Doug Turner (:dougt) 2010-08-31 10:08:04 PDT
The IsLowMemory predicate allows a piece of code test to see if we are in a low memory situation.  We only do this sort of test in two major places:

1) allocation of image data
2) during js callbacks

Testing for low memory requires us to read proc files, or acquire a kernal lock (like when we have to call into GlobalMemoryStatus on windows).  On Windows CE we disabled this check all together because of the cost.

(1) doesn't really matter that much in terms of perf, but (2) really does.

In addition, some memory allocators do reservations and commit on write.  In this case, the test would not actually do what you wanted.

So, I think we should move away from using IsLowMemory.  Instead, we should continue broadcasting memory-pressure notifications when we can and if the OS has such a feature.  For example, on osso, we get a notification that our process is running low on memory.  We can also detect this on Android.

If this is agreeable, we can remove the IsLowMemory() callers, make the call return false, and add documentation about deprecating this method.
Comment 1 Doug Turner (:dougt) 2010-08-31 11:14:30 PDT
Created attachment 470824 [details] [diff] [review]
patch v.1
Comment 2 :Felipe Gomes (needinfo me!) 2010-09-02 15:47:08 PDT
Comment 3 Eric Shepherd [:sheppy] 2010-09-08 12:39:15 PDT
Documented this change:

And mentioned it here as well:

and of course on Fx4 for developers.

Note You need to log in before you can comment on or make changes to this bug.