Closed
Bug 44352
Opened 24 years ago
Closed 12 years ago
graceful handling of *really* low memory conditions
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: dmosedale, Unassigned)
References
(Depends on 1 open bug)
Details
(Keywords: arch, memory-footprint, Whiteboard: [nsbeta3-])
Attachments
(4 files)
2.71 KB,
patch
|
Details | Diff | Splinter Review | |
2.74 KB,
patch
|
Details | Diff | Splinter Review | |
43.10 KB,
patch
|
Details | Diff | Splinter Review | |
32.82 KB,
patch
|
Details | Diff | Splinter Review |
It would be a really fine thing if applications using nsIMemory were
encouraged (required?) to register at least one nsIMemoryPressureObserver that
would do the following:
* sleep for a bit to let all other nsIMPOs complete their flushMemory()
callbacks.
* hope that the just-completed flushes have left enough memory to pop up a
dialog (or equivalent) saying "Mozilla is running out of memory. Please
consider closing any unused windows applications in order to free up some
memory."
Comment 1•24 years ago
|
||
Need nsIMemoryPressureObservers for:
- memory cache
- style cache
- (what else?)
The reserve memory thing may already be handled by the lower-level code on Mac.
Don't know about the other platforms though. This is going to be really hard to
test (or useless, depending on how you look at it) until we can get our memory
requirements down to a reasonable level to begin with. Pavlov tried to set a 64M
threshold, but we're way over that at this point.
We probably should file individual bugs on for individual
nsIMemoryPressureObservers though.
Assignee: warren → nobody
Target Milestone: --- → Future
Comment 2•24 years ago
|
||
Separate bugs might be better, or not (depending on who's gonna do the work).
For now, here's my recent guilty secret:
layout/xbl/src/nsXBLService.{h,cpp} maintain an LRU cache of nsXBLJSClasses, at
most 64. That quota could be raised (maybe it should be -- I need to talk with
hyatt). Right now, it's low enough that only at most 64(quota)*21(words)*4 or
5376 bytes can be tied up in the cache. But I think the right thing in general
is for nsXBLService to implement nsIMemoryPressureObserver. I'll do this unless
you want dibs, warren.
/be
Comment 3•24 years ago
|
||
Warren, do you want this bug too? It really should not be assigned to nobody.
/be
Comment 4•24 years ago
|
||
Adding more memory/cache buddies.
/be
Comment 5•24 years ago
|
||
I do a similar hack for string bundle caching, with a fixed size of 10 (total
size can vary greatly depending on the size of the string bundles in use)
Comment 6•24 years ago
|
||
I take it back.
Other caches to think about:
- xul cache (brutal sharing)
- string bundle cache
- registry?
- xpt
- open jar file cache
- rdf sort cache
- mail header cache
- mork?
Assignee: nobody → warren
Comment 7•24 years ago
|
||
Comment 8•24 years ago
|
||
Comment 9•24 years ago
|
||
I thought I would hack up an impl to see how it felt, what code bloat it added.
It just subroutined a bit of nsXBLService's destructor, and added a vtbl pointer
and the usual MI impl overhead. Hyatt, could you review my last patch and give
it an r=? I'll check it in when it's blessed by you or warren (or anyone on the
cc: list, really -- I'm easy!).
/be
Comment 10•24 years ago
|
||
Bug 41398 addresses the flusher for the memory cache.
Comment 11•24 years ago
|
||
I checked in the nsXBLService patch, so you can strike XBL from the list.
/be
Comment 12•24 years ago
|
||
The chrome registry holds on to overlay RDF data sources that it could
conceivably flush.
Comment 13•24 years ago
|
||
cc'ing myself
Updated•24 years ago
|
Comment 14•24 years ago
|
||
One discovery on my part, and a good suggestion by Wade:
First, I have the memory flushers hooked up on my system so that every 100,000
allocations, they kick in. This uncovered that they have to be called on the
right thread (duh). So then I was thinking that we should marshal a synchronous
event over to the mozilla thread to to the flushing, etc... ugh.
Wade suggested that we should abandon this nsIMemoryPressureObserver stuff in
favor of a simpler IsLowMemory predicate. This could be called at the point
where you're in the cache code, about to insert a new entry. If you discover
IsLowMemory is true, you can throw some things out.
This makes the algorithm more distributed, and avoids the thread-switching
problem, but it might not cover all low-memory cases we care about. (Note that
our current memory pressure hooks in nsIMemory aren't called in all cases either
though.)
Comment 15•24 years ago
|
||
*** Bug 45944 has been marked as a duplicate of this bug. ***
Comment 16•24 years ago
|
||
Comment 17•24 years ago
|
||
*** Bug 46337 has been marked as a duplicate of this bug. ***
Comment 18•24 years ago
|
||
This should not be marked Future. It's definitely a beta3 thing.
Target Milestone: Future → M20
Comment 19•24 years ago
|
||
need flusher for xul freelist (see 45353)
Updated•24 years ago
|
Whiteboard: [nsbeta3+]
Comment 20•24 years ago
|
||
*** Bug 48551 has been marked as a duplicate of this bug. ***
Reporter | ||
Comment 21•24 years ago
|
||
So from reading the bug, it appears that the plan may be to get rid of the
MemoryPressure stuff. Is this true? This seems like a bad thing to me, because
IsLowMemory() by itself doesn't allow for existing stuff to be flushed. e.g. if
I cache a connection, it may be reasonable to keep around at the time I cached
it, but 3 seconds later memory could fill up, and I'd be happy to throw it out.
Comment 22•24 years ago
|
||
Comment 23•24 years ago
|
||
See above patch:
1. Got rid of nsIMemoryPressureOBserver in favor of nsIObserver. Converted
current clients. Need review for string bundles, XBL service, and image loader.
2. Added memory flusher thread, predicated on implementation of IsLowMemory()
test. (In other words, it's #ifdef windows for now.)
3. Implemented pressure observer for XUL cache (hard whackage; replace
nsHashtable with PLDHashTable, mostly because nsHashtable is lame and won't let
you remove elements while enumerating). Need r=
Comment 24•24 years ago
|
||
r=sfraser on the nsImageManager changes
Comment 25•24 years ago
|
||
you rock chris
r=alecf on the string bundle stuff
Comment 26•24 years ago
|
||
Talked to warren about the nsXULPrototypeCache changes: gonna whack nsHashtable
to not bastardize the enumerator's return value so it can handle
deletion-during-enumeration. Tomorrow...
Comment 27•24 years ago
|
||
Comment 28•24 years ago
|
||
Added "aImmediate" argument to HeapMinimize(); when set to true, we'll try to do
heap minimization immediately; otherwise, we'll defer it by enqueuing an event.
sfraser: will this cover your case where Mac knows that it's low on memory and
wants people to start dumping stuff?
Also, fixed so that we *really* dump the image cache. Removed
nsXULPrototypeCache from this round: I'll get it in a second pass.
Comment 29•24 years ago
|
||
Checked in slightly modified round #2. Filing dependent bugs for remaining tasks...
Comment 31•24 years ago
|
||
Yes, the dependencies are a big bogus, too. Marking fixed. We can evaluate
dependencies individually.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 32•24 years ago
|
||
The memory pressure stuff rocks. Reopening, though, since there is not yet a
dialog that gets popped up (see the initial comment in this bug).
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 33•24 years ago
|
||
to ben goodger, who can assess whether or not we want to have a dialog pop up as
one of the memory pressure observers.
Assignee: waterson → ben
Status: REOPENED → NEW
Comment 35•24 years ago
|
||
*** Bug 60191 has been marked as a duplicate of this bug. ***
Comment 36•24 years ago
|
||
*** Bug 70824 has been marked as a duplicate of this bug. ***
Comment 37•24 years ago
|
||
Comment 38•24 years ago
|
||
nav triage team:
Not going to get done for beta, marking nsbeta1- and future. Reassigning to
alecf.
Updated•20 years ago
|
Product: Browser → Seamonkey
Updated•16 years ago
|
Assignee: alecf → general
Priority: P3 → --
QA Contact: doronr → general
Target Milestone: Future → ---
Updated•16 years ago
|
Assignee: general → nobody
Component: General → DOM
Product: SeaMonkey → Core
QA Contact: general → general
Updated•12 years ago
|
Status: NEW → RESOLVED
Closed: 24 years ago → 12 years ago
Resolution: --- → INCOMPLETE
Comment 39•12 years ago
|
||
This had at least one checked in patch (that was not done via blocking bug) and only issue, comment 32, was not addressed. So I suspect this should be notated as FIXED
(add bug 125400, because blocking bug 53313 was duped to it)
Depends on: 125400
Resolution: INCOMPLETE → FIXED
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•