Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Issue 6597038: Implementation of an STL compatible allocator for Courgette on Windows.... (Closed)

Created:
9 years, 9 months ago by tommi (sloooow) - chröme
Modified:
9 years, 7 months ago
Reviewers:
sra, sra1, grt (UTC plus 2)
CC:
chromium-reviews, amit
Visibility:
Public.

Description

Implementation of an STL compatible allocator for Courgette on Windows. This is to better handle low memory situations when applying a differential patch to a large Chrome setup. For reading input files, I'm also switching to using memory mapped files instead of ReadFileToString to reduce the load on the heap. TEST=courgette.exe should succeed in applying a patch between two chrome 10.x archives on an XP machine with 180MB of physical memory and no page file. BUG=72459, 73209 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=76320

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 24

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 3

Patch Set 5 : '' #

Total comments: 19

Patch Set 6 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+439 lines, -64 lines) Patch
M courgette/adjustment_method.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M courgette/adjustment_method_2.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M courgette/assembly_program.h View 1 2 4 chunks +6 lines, -3 lines 0 comments Download
M courgette/courgette.gyp View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M courgette/encoded_program.h View 1 2 3 chunks +18 lines, -12 lines 0 comments Download
M courgette/encoded_program.cc View 1 2 12 chunks +23 lines, -20 lines 0 comments Download
M courgette/ensemble_apply.cc View 1 2 1 chunk +8 lines, -26 lines 0 comments Download
A courgette/memory_allocator.h View 1 2 3 4 5 1 chunk +222 lines, -0 lines 0 comments Download
A courgette/memory_allocator.cc View 1 2 3 4 5 1 chunk +152 lines, -0 lines 0 comments Download
M courgette/streams.h View 1 2 2 chunks +6 lines, -1 line 0 comments Download

Messages

Total messages: 12 (0 generated)
tommi (sloooow) - chröme
9 years, 9 months ago (2011-02-27 22:28:56 UTC) #1
grt (UTC plus 2)
Just passing through... http://codereview.chromium.org/6597038/diff/5002/courgette/memory_allocator.cc File courgette/memory_allocator.cc (right): http://codereview.chromium.org/6597038/diff/5002/courgette/memory_allocator.cc#newcode34 courgette/memory_allocator.cc:34: file_util::CreateTemporaryFile(&path); what if this returns false? ...
9 years, 9 months ago (2011-02-28 15:06:41 UTC) #2
grt (UTC plus 2)
On 2011/02/28 15:06:41, grt wrote: > Just passing through... I forgot one comment about this ...
9 years, 9 months ago (2011-02-28 15:08:54 UTC) #3
tommi (sloooow) - chröme
thanks for driving by http://codereview.chromium.org/6597038/diff/5002/courgette/memory_allocator.cc File courgette/memory_allocator.cc (right): http://codereview.chromium.org/6597038/diff/5002/courgette/memory_allocator.cc#newcode34 courgette/memory_allocator.cc:34: file_util::CreateTemporaryFile(&path); On 2011/02/28 15:06:41, grt ...
9 years, 9 months ago (2011-02-28 17:50:00 UTC) #4
grt (UTC plus 2)
LGTM http://codereview.chromium.org/6597038/diff/7003/courgette/memory_allocator.h File courgette/memory_allocator.h (right): http://codereview.chromium.org/6597038/diff/7003/courgette/memory_allocator.h#newcode154 courgette/memory_allocator.h:154: count++; check for overflow. http://codereview.chromium.org/6597038/diff/7003/courgette/memory_allocator.h#newcode171 courgette/memory_allocator.h:171: if (!mapping->Initialize(bytes ...
9 years, 9 months ago (2011-02-28 18:08:34 UTC) #5
tommi (sloooow) - chröme
http://codereview.chromium.org/6597038/diff/7003/courgette/memory_allocator.h File courgette/memory_allocator.h (right): http://codereview.chromium.org/6597038/diff/7003/courgette/memory_allocator.h#newcode171 courgette/memory_allocator.h:171: if (!mapping->Initialize(bytes + 1)) { On 2011/02/28 18:08:34, grt ...
9 years, 9 months ago (2011-02-28 18:15:16 UTC) #6
sra1
I'm excited about this work. I have lots of comments but I'm basically OK with ...
9 years, 9 months ago (2011-02-28 20:28:38 UTC) #7
tommi (sloooow) - chröme
http://codereview.chromium.org/6597038/diff/4017/courgette/memory_allocator.cc File courgette/memory_allocator.cc (right): http://codereview.chromium.org/6597038/diff/4017/courgette/memory_allocator.cc#newcode88 courgette/memory_allocator.cc:88: write[size - 1] = 0; On 2011/02/28 20:28:38, sra1 ...
9 years, 9 months ago (2011-02-28 21:17:41 UTC) #8
tommi (sloooow) - chröme
So, it looks like around 5MB is a reasonable threshold. At 5170804 bytes, there are ...
9 years, 9 months ago (2011-02-28 21:52:57 UTC) #9
tommi (sloooow) - chröme
here's a more coarse breakdown of all the allocations: <1MB=6265 <2MB=53 <3MB=21 <4MB=20 <5MB=3 <6MB=10 ...
9 years, 9 months ago (2011-02-28 22:23:36 UTC) #10
tommi (sloooow) - chröme
latest changes uploaded. please take another look. On Mon, Feb 28, 2011 at 5:23 PM, ...
9 years, 9 months ago (2011-02-28 22:50:59 UTC) #11
sra1
9 years, 9 months ago (2011-02-28 23:18:07 UTC) #12
LGTM

http://codereview.chromium.org/6597038/diff/4017/courgette/memory_allocator.cc
File courgette/memory_allocator.cc (right):

http://codereview.chromium.org/6597038/diff/4017/courgette/memory_allocator.c...
courgette/memory_allocator.cc:120: size += sizeof(this);
On 2011/02/28 21:17:41, tommi wrote:
> On 2011/02/28 20:28:38, sra1 wrote:
> > FYI.  The assumption here is that the alignment of pointers (this) is as
> strict
> > or stricter than the alignment of the element type.  This is not always
true,
> > e.g. __m128 has 16-byte alignment.
> 
> Yes, for large objects the alignment will be broken.  However, this is not
> currently a problem.  Are you OK with me putting down a todo for myself to fix
> this?

TODO is fine.

http://codereview.chromium.org/6597038/diff/4017/courgette/memory_allocator.h
File courgette/memory_allocator.h (right):

http://codereview.chromium.org/6597038/diff/4017/courgette/memory_allocator.h...
courgette/memory_allocator.h:109: // deallocate it.
On 2011/02/28 21:17:41, tommi wrote:
> I thought about that kind of approach but went with this approach because it
was
> simpler and didn't depend on other allocations.  However, you have a point and
> I'm happy to oblige.
> Do you mind that I do that on a separate changelist and likely not in time for
> the push this week?

Sure.

http://codereview.chromium.org/6597038/diff/4017/courgette/memory_allocator.h...
courgette/memory_allocator.h:115: // 4MB is the maximum heap allocation size
that we'll attempt.
On 2011/02/28 21:17:41, tommi wrote:
> On 2011/02/28 20:28:38, sra1 wrote:
> > Say why it is 4MB, rather than, say, 128k or 32MB.
> 
> To be honest this is a finger-in-the air estimate based on non scientific
> observation.  Let me gather some numbers and pick something that I can more
> easily justify.  As for 32MB, that's likely too big.  I ran tests with 40MB as
> the cliff and it caused other heap allocations to start failing in low memory
> situatons.

Thanks for measuring.

Powered by Google App Engine
This is Rietveld 408576698