summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1998-06-22 00:19:45 -0400
committerGurusamy Sarathy <gsar@cpan.org>1998-06-23 06:06:23 +0000
commit8d6dde3e637be6ce74eec8ca77c5be73d19f769a (patch)
treeeb37e8ea49be3485b48a74821f527ac1fde1a018 /malloc.c
parent276493cb78ba879defeed992c4543a6fe30f98ce (diff)
downloadperl-8d6dde3e637be6ce74eec8ca77c5be73d19f769a.tar.gz
applied patch, regen headers
Message-Id: <199806220819.EAA03295@monk.mps.ohio-state.edu> Subject: [PATCH 5.004_67] Malloc size feedback p4raw-id: //depot/perl@1201
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/malloc.c b/malloc.c
index 6abd4502c3..ea00e5a5e5 100644
--- a/malloc.c
+++ b/malloc.c
@@ -1430,8 +1430,18 @@ calloc(register size_t elements, register size_t size)
MEM_SIZE
malloced_size(void *p)
{
- int bucket = OV_INDEX((union overhead *)p);
-
+ union overhead *ovp = (union overhead *)
+ ((caddr_t)p - sizeof (union overhead) * CHUNK_SHIFT);
+ int bucket = OV_INDEX(ovp);
+#ifdef RCHECK
+ /* The caller wants to have a complete control over the chunk,
+ disable the memory checking inside the chunk. */
+ if (bucket <= MAX_SHORT_BUCKET) {
+ MEM_SIZE size = BUCKET_SIZE_REAL(bucket);
+ ovp->ov_size = size + M_OVERHEAD - 1;
+ *((u_int *)((caddr_t)ovp + size + M_OVERHEAD - RSLOP)) = RMAGIC;
+ }
+#endif
return BUCKET_SIZE_REAL(bucket);
}