PyMem_MALLOC (was [Python-Dev] Snake farm)

Tim Peters tim.one@comcast.net
Sat, 23 Nov 2002 23:20:42 -0500


[Guido]
> ...
> But I'd like to see this fixed in configure, not in pymalloc.  (Tim
> seems to favor always ensuring that we never call malloc(0),

Or realloc(0).

> but I can't see how that can be done without an extra test+jump. :-( )

Probably can't be, but this is ideal for a conditional-move instruction, and
more architectures are growing that.  In the meantime, Martin made this
change, and I haven't measured a slowdown on my box (it is an extra
test-&-branch under MSVC, but the branch is over just one instruction so
doesn't (I believe) flush the pipeline).