[snake-farm] Re: [Python-Dev] Snake farm

Tim Peters tim.one@comcast.net
Sun, 10 Nov 2002 20:28:24 -0500


[Guido]
> Marc, pymalloc is supposed to be bulletproof.

Not necessarily.  It's not possible to write a memory manager in 100% std C,
and some platform may be bizarre enough that pymalloc just can't be used on
it.  We haven't found one yet, though.  Simple example:  if some platform
requires 16-byte aligned addresses, pymalloc will plain fail on that
platform.  Or, I'm unsure what would happen on a word-adressed machine, but
I am sure it wouldn't be pretty <wink>.  Or the OS and/or HW may do read
protection at the byte level, so that pymalloc's belief that it can always
read stuff from "the next lower pool boundary" is wrong here.  There are
lots of things that *could* go wrong.

> If there's a segfault that can be avoided by disabling pymalloc, that's
> a bug in pymalloc.

Again not necessarily:  there's tricky casting code throughout pymalloc (as
there is in any low-level memory manager), and a compiler optimization
and/or codegen bug would be my first guess.  So the first thing I'd do is
recompile pymalloc without optimization.

> Would you mind helping us find this bug?

Please yes -- there's no way to guess.