[PATCH 7/7] Remove variable length arrays and declarations within code

Jason Evans jasone at canonware.com
Mon Apr 23 11:53:23 PDT 2012


On Apr 22, 2012, at 1:46 AM, Mike Hommey wrote:
> On Sun, Apr 22, 2012 at 01:08:19AM -0700, Jason Evans wrote:
>> On Apr 19, 2012, at 11:38 PM, Mike Hommey wrote:
>>> From: Mike Hommey <mh at glandium.org>
>>> 
>>> MSVC doesn't support C99, and building as C++ to be able to use them is
>>> dangerous, as C++ and C99 are incompatible.
>>> ---
>>> include/jemalloc/internal/prof.h |    3 ++-
>>> src/arena.c                      |   17 ++++++++++-------
>>> src/chunk_mmap.c                 |    5 +++--
>>> src/ctl.c                        |    6 ++++--
>>> src/stats.c                      |   12 ++++++++----
>>> src/tsd.c                        |    2 +-
>>> test/bitmap.c                    |   12 ++++++++----
>>> 7 files changed, 36 insertions(+), 21 deletions(-)
>> 
>> This diff adds calls to malloc/free from within the allocator, which
>> perturbs heap profiling.  imalloc/idalloc are probably what you want
>> instead.
> 
> alloca might work, too, if you're okay using it. We could also have a
> helper macro using variable length arrays or alloca depending on the
> value of __STDC_VERSION__...

I kind of like the helper macro idea (use variable length arrays when available, otherwise use alloca()).

Jason


More information about the jemalloc-discuss mailing list