Author: Armin Rigo <[email protected]>
Branch: stm-gc
Changeset: r54522:bb87d3a5b07d
Date: 2012-04-19 11:51 +0200
http://bitbucket.org/pypy/pypy/changeset/bb87d3a5b07d/
Log: Play nicely with 'MALLOC_CHECK_', the checking done by glibc's
malloc, which is unhappy about the overwrite of 4 bytes with
0xDDDDDDDD if we allocated less than 4 bytes.
diff --git a/pypy/translator/c/src/allocator.h
b/pypy/translator/c/src/allocator.h
--- a/pypy/translator/c/src/allocator.h
+++ b/pypy/translator/c/src/allocator.h
@@ -24,8 +24,8 @@
#ifndef PYPY_NOT_MAIN_FILE
#if defined(TRIVIAL_MALLOC_DEBUG)
- void *PyObject_Malloc(size_t n) { return malloc(n); }
- void *PyObject_Realloc(void *p, size_t n) { return realloc(p, n); }
+ void *PyObject_Malloc(size_t n) { return malloc(n<4?4:n)); }
+ void *PyObject_Realloc(void *p, size_t n) { return realloc(p, n<4?4:n); }
void PyObject_Free(void *p) { if (p) { *((int*)p) = 0xDDDDDDDD; } free(p); }
#elif defined(LINUXMEMCHK)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit