This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: valgrind confused by std::allocator calls to operator new(0)


Michael Veksler wrote:

It may be viewed as a low priority regression. In gcc-3.2 std::allocator
does not behave this way.


Well, it depends on the allocator you select at library build time: for instance, the equivalent allocator in mainline (pool) or the default (mt) also don't call new(0).

Is it possible/reasonable to change new_allocator::allocate such that
it returns NULL when __n ==0 ? Should I open a PR against libstdc++?

I agree that calling new(0) is dumb and we should simply standardize on the behavior of pool and mt: it's just a matter of adding a conditional to new_allocator, seems safe for 3.4.4 too. Please file a PR, thanks.

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]