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

Issue 391044: For Linux, override malloc and friends so that we can detect and then stop on... (Closed)

Created:
11 years, 1 month ago by vandebo (ex-Chrome)
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, John Grabowski, pam+watch_chromium.org, brettw+cc_chromium.org
Visibility:
Public.

Description

For Linux, override malloc and friends so that we can detect and then stop on out of memory. BUG=27222 TEST=new base unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=32395

Patch Set 1 #

Patch Set 2 : Resync - mac change got committed #

Patch Set 3 : '' #

Patch Set 4 : #ifdef -> #if defined() #

Total comments: 7

Patch Set 5 : Add unit tests and pretty up macros #

Patch Set 6 : Remove extra ; #

Patch Set 7 : Readability & style. Fix new unittest on 32bit Linux #

Unified diffs Side-by-side diffs Delta from patch set Stats (+193 lines, -1 line) Patch
M base/process_util_linux.cc View 1 2 3 4 5 6 2 chunks +99 lines, -1 line 0 comments Download
M base/process_util_unittest.cc View 5 6 3 chunks +94 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
vandebo (ex-Chrome)
11 years, 1 month ago (2009-11-13 03:16:01 UTC) #1
willchan no longer on Chromium
On 2009/11/13 03:16:01, vandebo wrote: > I don't know that it makes sense to do ...
11 years, 1 month ago (2009-11-13 05:08:49 UTC) #2
vandebo (ex-Chrome)
Will may be out of the office at this point, so I'd appreciate comments from ...
11 years, 1 month ago (2009-11-13 22:50:59 UTC) #3
vandebo (ex-Chrome)
ping
11 years, 1 month ago (2009-11-16 21:02:05 UTC) #4
willchan no longer on Chromium
On 2009/11/16 21:02:05, vandebo wrote: > ping I'm a bit concerned about the possible performance ...
11 years, 1 month ago (2009-11-16 21:51:39 UTC) #5
jar (doing other things)
Please add unittest cases, per comments below. Thanks, Jim http://codereview.chromium.org/391044/diff/7002/7003 File base/process_util_linux.cc (right): http://codereview.chromium.org/391044/diff/7002/7003#newcode504 Line ...
11 years, 1 month ago (2009-11-16 22:04:37 UTC) #6
vandebo (ex-Chrome)
http://codereview.chromium.org/391044/diff/7002/7003 File base/process_util_linux.cc (right): http://codereview.chromium.org/391044/diff/7002/7003#newcode504 Line 504: CHECK(false) << On 2009/11/16 22:04:37, jar wrote: > ...
11 years, 1 month ago (2009-11-18 02:20:42 UTC) #7
jar (doing other things)
11 years, 1 month ago (2009-11-18 03:20:53 UTC) #8
LGTM (with one nit readability change indicated below).

Sorry about my confusion/error.

http://codereview.chromium.org/391044/diff/7002/7003
File base/process_util_linux.cc (right):

http://codereview.chromium.org/391044/diff/7002/7003#newcode541
Line 541: static void* (*libc_##func)(size_t) = \
Ah... you are correct. I misread.

Please change the local name to something more readable to lessen confusion. 
Since the local variable is not matching anything external at all, it may as
well be a simple name without any macro-concatenation operator, such as:
original_function
or
intercepted_function
or
library_function

There is seemingly no reason to have distinct local variable names in each of
the macros, and IMO it hurt (my) readability.

Thanks!

On 2009/11/18 02:20:43, vandebo wrote:
> On 2009/11/16 22:04:37, jar wrote:
> > It would appear this is the second time you're prepending "libc_" to the
name,
> 
> This is the local name for the real function.
> 
> > and hence you are for example overriding:
> > 
> > libc_malloc
> > libc_libc_malloc
> > 
> > but not
> > 
> > malloc

Powered by Google App Engine
This is Rietveld 408576698