mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Added VCHECK compile time option that fills allocated and freed blocks
with garbage.
This commit is contained in:
parent
e86cbc43f2
commit
05cf7e040b
1 changed files with 7 additions and 0 deletions
|
@ -57,6 +57,7 @@ static char *rcsid = "$Id$";
|
||||||
#define DEBUG2
|
#define DEBUG2
|
||||||
#define MSTATS
|
#define MSTATS
|
||||||
#define RCHECK
|
#define RCHECK
|
||||||
|
#define VCHECK
|
||||||
|
|
||||||
typedef unsigned char u_char;
|
typedef unsigned char u_char;
|
||||||
typedef unsigned long u_long;
|
typedef unsigned long u_long;
|
||||||
|
@ -221,6 +222,9 @@ malloc(nbytes)
|
||||||
op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1);
|
op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1);
|
||||||
op->ov_rmagic = RMAGIC;
|
op->ov_rmagic = RMAGIC;
|
||||||
*(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
|
*(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
|
||||||
|
#endif
|
||||||
|
#ifdef VCHECK
|
||||||
|
memset((char *)(op+1), 0x41, nbytes);
|
||||||
#endif
|
#endif
|
||||||
return ((char *)(op + 1));
|
return ((char *)(op + 1));
|
||||||
}
|
}
|
||||||
|
@ -286,6 +290,9 @@ free(cp)
|
||||||
#ifdef RCHECK
|
#ifdef RCHECK
|
||||||
ASSERT(op->ov_rmagic == RMAGIC);
|
ASSERT(op->ov_rmagic == RMAGIC);
|
||||||
ASSERT(*(u_short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC);
|
ASSERT(*(u_short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC);
|
||||||
|
#endif
|
||||||
|
#ifdef VCHECK
|
||||||
|
memset(cp, 43, op->ov_size);
|
||||||
#endif
|
#endif
|
||||||
size = op->ov_index;
|
size = op->ov_index;
|
||||||
if ( size == 0xff ) {
|
if ( size == 0xff ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue