From 810111b543df53f85bfe5722db79870ca00b1a3e Mon Sep 17 00:00:00 2001 From: "graehl@gmail.com" Date: Wed, 29 Sep 2010 04:54:32 +0000 Subject: value_array never call allocate(0) since it seems to leak git-svn-id: https://ws10smt.googlecode.com/svn/trunk@662 ec762483-ff6d-05da-a07a-a48fb63a330f --- utils/value_array.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/utils/value_array.h b/utils/value_array.h index 2010fefe..bd6ef27a 100755 --- a/utils/value_array.h +++ b/utils/value_array.h @@ -171,16 +171,19 @@ public: //copy any existing data like std::vector. not A::construct exception safe. try blah blah? swap? void resize(size_type s, const_reference t = T()) { - pointer na=A::allocate(s); - size_type nc=s @@ -270,7 +273,7 @@ public: ValueArray(ValueArray const& other) : A(other) , sz(other.sz) - , array(A::allocate(sz)) + , array(sz?A::allocate(sz):0) { copy_construct(other.begin(),other.end(),array); @@ -286,7 +289,7 @@ public: ValueArray( Range const& v , typename boost::disable_if< boost::is_integral >::type* = 0) : sz(boost::size(v)) - , array(A::allocate(sz)) + , array(sz?A::allocate(sz):0) { copy_construct(boost::begin(v),boost::end(v),array); } -- cgit v1.2.3