[Python-Dev] [Python-checkins] commit of r41906 - python/branches/ssize_t/Objects/obmalloc.c (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Tue Jan 3 22:59:42 CET 2006
- Previous message: [Python-Dev] [Python-checkins] commit of r41906 - python/branches/ssize_t/Objects/obmalloc.c
- Next message: [Python-Dev] [Python-checkins] commit of r41906 - python/branches/ssize_t/Objects/obmalloc.c
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tim Peters wrote:
Modified: python/branches/ssizet/Objects/obmalloc.c [...] This checkin should be reverted for now.
Not sure whether you've noticed this is "just" on the ssize_t branch. Without this patch, it is not possible to allocate 4GiB or more for a string object in debug mode, which kind of defeated my attempts to test that.
I certainly plan to remove all XXX marks I have introduced in that branch before suggesting to integrate it back into the trunk.
So "for now", I would prefer to keep it, and only revert it if I have a complete fix.
It's in PyObjectDebugMalloc, and at present the layout of the extra debug info in a PYMALLOCDEBUG build is hard-coded to use 4-byte fields, no matter what sizeof(sizet) may be. One of the extra fields recorded in a PYMALLOCDEBUG build is the number of bytes requested, and at present it's simply not capable of recording a value that doesn't fit in 4 bytes.
Well, AFAICT, it "works" even if it records only records the lower 4 bytes of the requested size. Upon freeing, it just won't put enough DEADBYTEs in, which I cannot see having further unfortunate consequences (except that it won't diagnose errors as good anymore as it could).
Even after (if ever ;-)) this is changed to support recording 8-byte values on a box where sizeof(sizet) == 8, the "total < nbytes" part of the test would still be appropriate: PyObjectDebugMalloc requests more memory (
total
) than the user asked for (nbytes
), and the computation oftotal
may have overflowed. That's what "total < nbytes" is checking, and that's the right way to spell the overflow check on any box.
Certainly; I did not mean to completely disable this test.
Regards, Martin
- Previous message: [Python-Dev] [Python-checkins] commit of r41906 - python/branches/ssize_t/Objects/obmalloc.c
- Next message: [Python-Dev] [Python-checkins] commit of r41906 - python/branches/ssize_t/Objects/obmalloc.c
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]