summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-07-02 13:07:26 +0000
committerNicholas Clark <nick@ccl4.org>2005-07-02 13:07:26 +0000
commit77354fb48907e3618a62531aa2e90772ef4375d9 (patch)
treee0d266e831c4ff7e4dd2ce0c7429e0e44744e193 /sv.c
parent9320a0378277d341c9c126313f5ba5a16b26450d (diff)
downloadperl-77354fb48907e3618a62531aa2e90772ef4375d9.tar.gz
Don't inline offer_nice_chunk, as it's rarely called.
p4raw-id: //depot/perl@25047
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index e3a8a29fba..038192b232 100644
--- a/sv.c
+++ b/sv.c
@@ -165,6 +165,27 @@ Public API:
* "A time to plant, and a time to uproot what was planted..."
*/
+/*
+ * nice_chunk and nice_chunk size need to be set
+ * and queried under the protection of sv_mutex
+ */
+void
+Perl_offer_nice_chunk(pTHX_ void *chunk, U32 chunk_size)
+{
+ void *new_chunk;
+ U32 new_chunk_size;
+ LOCK_SV_MUTEX;
+ new_chunk = (void *)(chunk);
+ new_chunk_size = (chunk_size);
+ if (new_chunk_size > PL_nice_chunk_size) {
+ Safefree(PL_nice_chunk);
+ PL_nice_chunk = (char *) new_chunk;
+ PL_nice_chunk_size = new_chunk_size;
+ } else {
+ Safefree(chunk);
+ }
+ UNLOCK_SV_MUTEX;
+}
#ifdef DEBUG_LEAKING_SCALARS
# ifdef NETWARE