Rejig the definition of ARENAS_PER_SET to maximise the size of the
authorNicholas Clark <nick@ccl4.org>
Sat, 4 Feb 2006 13:27:00 +0000 (13:27 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 4 Feb 2006 13:27:00 +0000 (13:27 +0000)
array whilst keeping the structure within PERL_ARENA_SIZE.

p4raw-id: //depot/perl@27081

sv.c

diff --git a/sv.c b/sv.c
index 2c9a593..babfe9d 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -584,7 +584,14 @@ struct arena_desc {
     */
 };
 
-#define ARENAS_PER_SET  256+64 /* x 3words/arena_desc -> ~ 4kb/arena_set */
+struct arena_set;
+
+/* Get the maximum number of elements in set[] such that struct arena_set
+   will fit within PERL_ARENA_SIZE, which is probabably just under 4K, and
+   therefore likely to be 1 aligned memory page.  */
+
+#define ARENAS_PER_SET  ((PERL_ARENA_SIZE - sizeof(struct arena_set*) \
+                         - 2 * sizeof(int)) / sizeof (struct arena_desc))
 
 struct arena_set {
     struct arena_set* next;