Closed Bug 520491 Opened 15 years ago Closed 15 years ago

Updater uses lots of memory and disk space for partial updates

Categories

(Toolkit :: Application Update, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- final-fixed

People

(Reporter: Dolske, Assigned: Dolske)

References

Details

Attachments

(1 file)

I took a look at malloc() usage while working on an update to bug 517102... For full updates, we're in good shape. There doesn't seem to be much allocation going on at all. For partial updates things are much different. 1) PatchFile::Prepare() calls LoadSourceFile(), which allocates a buffer equal to the size of the file being patched. Since this buffer isn't actually used until ::ExecutePatch, the updater will basically alloc memory equal to the size of all files being patched before it ever actually does anything. For release builds (where partials probably touch nearly every file), this means we're gobbling up heap equal to the size of the entire app's disk footprint. 2) MBS_ApplyPatch() allocates a buffer equal to the size of the entire decompressed patch file. Looking at my debug log for a OS X 3.5.2 -> 3.5.3 partial, this seems to be about the same size of the original file. This buffer is deallocated at the end of MBS_ApplyPatch, so to peak memory usage occurs when patching the largest file. [In my case, libxul at 31MB.] A bit of math implies these two issues result in the updater's peak usage being 77MB of memory on OS X. Probably about 1/2 that on other platforms. This isn't a big deal for desktop apps, but on a mobile device that's a significant amount of memory, and might be enough to cause partial updates to fail. Fixing #2 looks like it could be a Hard Problem, but it should be fairly easy to defer the allocation in #1 until ::Execute(). That would help some...
Flags: blocking1.9.2?
Wanted, but I don't think we'd block on this, but interested to hear from Vlad and Stuart about their thoughts.
Flags: wanted1.9.2+
Flags: blocking1.9.2?
Flags: blocking1.9.2-
Attached patch Patch v.1 (deleted) — Splinter Review
Reduces memory and disk space usage by not reading in patch files until they're about to be applied, and deleting the patch file immediately after applying it.
Assignee: nobody → dolske
Attachment #412981 - Flags: review?(robert.bugzilla)
Attachment #412981 - Flags: review?(robert.bugzilla) → review+
Comment on attachment 412981 [details] [diff] [review] Patch v.1 Looks and works fine. I'm just a tad concerned about making changes to the updater this late in the game but the value of lessening disk space usage on mobile would be a very good thing.
Summary: Updater uses lots of memory for partial updates → Updater uses lots of memory and disk space for partial updates
Attachment #412981 - Flags: approval1.9.2?
Let's get this on trunk and given a full testing shakedown before we take it on branch. I'm also really nervous about taking it this late in the game.
(a=beltzner for mozilla-central for baking, with an eye towards landing on 192)
Pushed to mozilla-central for baking http://hg.mozilla.org/mozilla-central/rev/c10ea5e5eab3
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment on attachment 412981 [details] [diff] [review] Patch v.1 a192=beltzner, hoping this isn't the patch I regret taking ;)
Attachment #412981 - Flags: approval1.9.2? → approval1.9.2+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: