[Python-Dev] Memory size overflows

Christian Tismer tismer@tismer.com
Sat, 12 Oct 2002 22:37:43 -0700


Tim Peters wrote:
> [Armin Rigo]
> 
>>All around the C code there are potential problems with objects of very
>>large sizes (http://www.python.org/sf/618623).  The problem is that to
>>allocate a variable-sized object of type 't' with 'n' elements we
>>compute 'n*t->tp_itemsize', which can overflow even if 'n' is a
>>perfectly legal value.
> 
> 
> I confess I always ignore these until one pops up in real life.  Checking
> slows the code, and that causes me pain <0.5 wink>.
> 
> Note that the multiplication isn't the only problem:  we usually go on to
> add in the size of the object header, and that can overflow too.  This leads
> to heartbreaking code such as string_repeat's:

(sigh)

[snipped all the rest of good stuff]

May I throw in a "weird" idea, again?

I'm thinking since quite some time that Python should
really abandon 32 bit arithmetic once and forwver and
switch to use 64 bits, everywhere.
It would not be the first scripting language which
does so (wasn't it Ruby?), and it would benefit from that
quite much, I think.

I believe that 32 bit technology is outworn like 16 bits
have before. When? Well, I'd say 16 years ago, exactly,
if we assume an increase of memory size of 1 bit per year,
which seems realistic.

There are already a couple of 64 bit machines running Python.
These would not see any slow-down by switching to 64 bits.
New upcoming processors a likely to be 64 bitters pretty soon,
and I hope to see such a nice machine like Knuth's MMIX
in the next five years or earlier.
Most probably, 64 bits will then be state of the art,
and by switching to it right now, we are solving a lot
of problems for the next 32 years ahead.
This is beyond the careers of most of the "old" guys
around, giving us a chance to solve some problem
"once and forever".
The current small speed loss will vanish from alone :)

It-might-sound-funny-but-it-*is*-my-opinion - ly y'rs chris

-- 
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/