Pre-allocate viaduct buffer
Categories
(Application Services :: General, enhancement)
Tracking
(firefox159 fixed, firefox160 fixed)
People
(Reporter: bdk, Assigned: bdk)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fxsync-])
Attachments
(1 external file)
https://bugzilla.mozilla.org/show_bug.cgi?id=1992618 shows crash increases that are related to OOM errors. Our working theory is that this is related to large viaduct downloads. To test this theory and maybe fix the issue for some users, let's try pre-allocating our buffer when we can. This reduces the total allocated bytes because we can size the array to the exact right size rather than rely on grow-able arrays, which double in size each time they exceed the allocation. That doubling can mean we use up to 2x more memory than needed. It also reduces the total number of allocations, since we don't spend time allocating smaller arrays which get overflow and need to be replaced with larger ones.
If our theory is right than we should see some reduction in crashes when we introduce this change. I don't expect this to fix the problem altogether, but it should at least give us some info and if we're lucky it might significantly reduce the impact.
Note that we can only perform this optimization if we get a content-length header, but we should get that in most cases (sync, remote settings, etc.).
Updated•1 month ago
|
Comment 1•1 month ago
|
||
(via GitHub webhook, authenticated as shared-secret)
Comment 2•1 month ago
|
||
Authored by https://github.com/bendk
https://github.com/mozilla/application-services/commit/d4057dd5972a7c83aa279f4f342d42f4b163222c
[main] Bug 2079421 - pre-allocate viaduct buffer (#7641)
(via GitHub webhook, authenticated as shared-secret)
Updated•26 days ago
|
Updated•26 days ago
|
Updated•24 days ago
|
Description
•