Closed Bug 76329 Opened 24 years ago Closed 23 years ago

nsComponentManager uses too much memory for registry

Categories

(Core :: XPCOM, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla0.9.7

People

(Reporter: dveditz, Assigned: dveditz)

References

Details

(Keywords: memory-footprint)

Attachments

(1 file)

To speed startup time the component manager sets a very large buffer for the component registry. It was shrinking it at the end of XPCOM initialization, but then lots of other startup tasks (intl charset converters and various category things) re-read the same data repeatedly. nsComponentManager should be a memory-pressure listener and shrink the registry buffer at some time after startup. Better yet, the component registration data could be moved into a flat file or two that could be read and parsed much quicker than the libreg format. the Component manager is not really benefitting from the libreg hierarchical structure.
Keywords: footprint
Blocks: 71874
*** Bug 101961 has been marked as a duplicate of this bug. ***
Blocks: 92580
Shaver attached a patch in bug 101961 (attachment 51241 [details] [diff] [review]). Is there anything wrong with it? If not, let's get it checked in. This is the single largest consumer of memory in the product. Type Count Bytes %Total %Cov TOTAL 134673 6864031 100.00 0.00 registry-Buffer 1 512000 7.46 7.46 xpti-unclassified 263 288976 4.21 11.67 JS-script 4158 280874 4.09 15.76 nsImageGTK 264 239236 3.49 19.25 gtk-unclassified 4402 208766 3.04 22.29 JSScopeProperty 5718 205848 3.00 25.29 nsString 4465 201869 2.94 28.23 nsZipArchive 4049 182925 2.66 30.89 js_MatchToken 6505 174616 2.54 33.44 OTHER 104848 4568921 66.56 100.00
Severity: minor → major
Keywords: patch
Target Milestone: --- → mozilla0.9.6
attachment 51241 [details] [diff] [review] from bug 101961 deletes too much, it should simply uncomment the two lines that shrink the buffer. If applied we get back to startup registry churn because the i18n folks are still grovelling for charset converters. It's a 2-3% startup hit so that needs to get fixed first.
Depends on: 74815
Target Milestone: mozilla0.9.6 → mozilla0.9.7
Blocks: 27510
Shrink the big registry buffer back to default size before the end of XPCOM init. Explicitly initialize the Category manager during that time so its registry enumerations happen while we've already got the data in memory. Also changed the default registry buffer size from 64K to 8K (for other nsIRegistry consumers)
Comment on attachment 59777 [details] [diff] [review] patch that eliminates registry footprint problem >-#define BUFIO_BUFSIZE_DEFAULT 0x10000 >+#define BUFIO_BUFSIZE_DEFAULT 0x2000 Clearer as decimal? Use PAGE_SIZE to tune it? Just thinking aloud. >+ // Create the category manage to ensure prepopulation of categories >+ nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID); Do we need to use the service manager for this? Hmm, probably not worth making a more direct call. Never mind. sr=shaver.
Attachment #59777 - Flags: superreview+
Comment on attachment 59777 [details] [diff] [review] patch that eliminates registry footprint problem add a comment why this buffer has to be the size it is. with that r=dougt
Attachment #59777 - Flags: review+
Comment on attachment 59777 [details] [diff] [review] patch that eliminates registry footprint problem add a comment why this buffer has to be the size it is. with that r=dougt
Made dougt's suggested comment change and checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Oh, this dropped MH (max heap size) by half a MB! Way to go!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: