ggc.h: Convert to ISO C90 prototypes.
[gcc.git] / gcc / ggc-common.c
1 /* Simple garbage collection for the GNU compiler.
2 Copyright (C) 1999, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22 /* Generic garbage collection (GC) functions and data, not specific to
23 any particular GC implementation. */
24
25 #include "config.h"
26 #include "system.h"
27 #include "coretypes.h"
28 #include "hashtab.h"
29 #include "ggc.h"
30 #include "toplev.h"
31 #include "params.h"
32
33 #ifdef HAVE_SYS_RESOURCE_H
34 # include <sys/resource.h>
35 #endif
36
37 #ifdef HAVE_MMAP_FILE
38 # include <sys/mman.h>
39 #endif
40
41 #ifdef ENABLE_VALGRIND_CHECKING
42 # ifdef HAVE_MEMCHECK_H
43 # include <memcheck.h>
44 # else
45 # include <valgrind.h>
46 # endif
47 #else
48 /* Avoid #ifdef:s when we can help it. */
49 #define VALGRIND_DISCARD(x)
50 #endif
51
52 /* Statistics about the allocation. */
53 static ggc_statistics *ggc_stats;
54
55 struct traversal_state;
56
57 static int ggc_htab_delete (void **, void *);
58 static hashval_t saving_htab_hash (const void *);
59 static int saving_htab_eq (const void *, const void *);
60 static int call_count (void **, void *);
61 static int call_alloc (void **, void *);
62 static int compare_ptr_data (const void *, const void *);
63 static void relocate_ptrs (void *, void *);
64 static void write_pch_globals (const struct ggc_root_tab * const *tab,
65 struct traversal_state *state);
66 static double ggc_rlimit_bound (double);
67
68 /* Maintain global roots that are preserved during GC. */
69
70 /* Process a slot of an htab by deleting it if it has not been marked. */
71
72 static int
73 ggc_htab_delete (void **slot, void *info)
74 {
75 const struct ggc_cache_tab *r = (const struct ggc_cache_tab *) info;
76
77 if (! (*r->marked_p) (*slot))
78 htab_clear_slot (*r->base, slot);
79 else
80 (*r->cb) (*slot);
81
82 return 1;
83 }
84
85 /* Iterate through all registered roots and mark each element. */
86
87 void
88 ggc_mark_roots (void)
89 {
90 const struct ggc_root_tab *const *rt;
91 const struct ggc_root_tab *rti;
92 const struct ggc_cache_tab *const *ct;
93 const struct ggc_cache_tab *cti;
94 size_t i;
95
96 for (rt = gt_ggc_deletable_rtab; *rt; rt++)
97 for (rti = *rt; rti->base != NULL; rti++)
98 memset (rti->base, 0, rti->stride);
99
100 for (rt = gt_ggc_rtab; *rt; rt++)
101 for (rti = *rt; rti->base != NULL; rti++)
102 for (i = 0; i < rti->nelt; i++)
103 (*rti->cb)(*(void **)((char *)rti->base + rti->stride * i));
104
105 ggc_mark_stringpool ();
106
107 /* Now scan all hash tables that have objects which are to be deleted if
108 they are not already marked. */
109 for (ct = gt_ggc_cache_rtab; *ct; ct++)
110 for (cti = *ct; cti->base != NULL; cti++)
111 if (*cti->base)
112 {
113 ggc_set_mark (*cti->base);
114 htab_traverse_noresize (*cti->base, ggc_htab_delete, (void *) cti);
115 ggc_set_mark ((*cti->base)->entries);
116 }
117 }
118
119 /* Allocate a block of memory, then clear it. */
120 void *
121 ggc_alloc_cleared (size_t size)
122 {
123 void *buf = ggc_alloc (size);
124 memset (buf, 0, size);
125 return buf;
126 }
127
128 /* Resize a block of memory, possibly re-allocating it. */
129 void *
130 ggc_realloc (void *x, size_t size)
131 {
132 void *r;
133 size_t old_size;
134
135 if (x == NULL)
136 return ggc_alloc (size);
137
138 old_size = ggc_get_size (x);
139 if (size <= old_size)
140 {
141 /* Mark the unwanted memory as unaccessible. We also need to make
142 the "new" size accessible, since ggc_get_size returns the size of
143 the pool, not the size of the individually allocated object, the
144 size which was previously made accessible. Unfortunately, we
145 don't know that previously allocated size. Without that
146 knowledge we have to lose some initialization-tracking for the
147 old parts of the object. An alternative is to mark the whole
148 old_size as reachable, but that would lose tracking of writes
149 after the end of the object (by small offsets). Discard the
150 handle to avoid handle leak. */
151 VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS ((char *) x + size,
152 old_size - size));
153 VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (x, size));
154 return x;
155 }
156
157 r = ggc_alloc (size);
158
159 /* Since ggc_get_size returns the size of the pool, not the size of the
160 individually allocated object, we'd access parts of the old object
161 that were marked invalid with the memcpy below. We lose a bit of the
162 initialization-tracking since some of it may be uninitialized. */
163 VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (x, old_size));
164
165 memcpy (r, x, old_size);
166
167 /* The old object is not supposed to be used anymore. */
168 VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (x, old_size));
169
170 return r;
171 }
172
173 /* Like ggc_alloc_cleared, but performs a multiplication. */
174 void *
175 ggc_calloc (size_t s1, size_t s2)
176 {
177 return ggc_alloc_cleared (s1 * s2);
178 }
179
180 /* These are for splay_tree_new_ggc. */
181 void *
182 ggc_splay_alloc (int sz, void *nl)
183 {
184 if (nl != NULL)
185 abort ();
186 return ggc_alloc (sz);
187 }
188
189 void
190 ggc_splay_dont_free (void * x ATTRIBUTE_UNUSED, void *nl)
191 {
192 if (nl != NULL)
193 abort ();
194 }
195
196 /* Print statistics that are independent of the collector in use. */
197 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
198 ? (x) \
199 : ((x) < 1024*1024*10 \
200 ? (x) / 1024 \
201 : (x) / (1024*1024))))
202 #define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))
203
204 void
205 ggc_print_common_statistics (FILE *stream ATTRIBUTE_UNUSED,
206 ggc_statistics *stats)
207 {
208 /* Set the pointer so that during collection we will actually gather
209 the statistics. */
210 ggc_stats = stats;
211
212 /* Then do one collection to fill in the statistics. */
213 ggc_collect ();
214
215 /* At present, we don't really gather any interesting statistics. */
216
217 /* Don't gather statistics any more. */
218 ggc_stats = NULL;
219 }
220 \f
221 /* Functions for saving and restoring GCable memory to disk. */
222
223 static htab_t saving_htab;
224
225 struct ptr_data
226 {
227 void *obj;
228 void *note_ptr_cookie;
229 gt_note_pointers note_ptr_fn;
230 gt_handle_reorder reorder_fn;
231 size_t size;
232 void *new_addr;
233 };
234
235 #define POINTER_HASH(x) (hashval_t)((long)x >> 3)
236
237 /* Register an object in the hash table. */
238
239 int
240 gt_pch_note_object (void *obj, void *note_ptr_cookie,
241 gt_note_pointers note_ptr_fn)
242 {
243 struct ptr_data **slot;
244
245 if (obj == NULL || obj == (void *) 1)
246 return 0;
247
248 slot = (struct ptr_data **)
249 htab_find_slot_with_hash (saving_htab, obj, POINTER_HASH (obj),
250 INSERT);
251 if (*slot != NULL)
252 {
253 if ((*slot)->note_ptr_fn != note_ptr_fn
254 || (*slot)->note_ptr_cookie != note_ptr_cookie)
255 abort ();
256 return 0;
257 }
258
259 *slot = xcalloc (sizeof (struct ptr_data), 1);
260 (*slot)->obj = obj;
261 (*slot)->note_ptr_fn = note_ptr_fn;
262 (*slot)->note_ptr_cookie = note_ptr_cookie;
263 if (note_ptr_fn == gt_pch_p_S)
264 (*slot)->size = strlen (obj) + 1;
265 else
266 (*slot)->size = ggc_get_size (obj);
267 return 1;
268 }
269
270 /* Register an object in the hash table. */
271
272 void
273 gt_pch_note_reorder (void *obj, void *note_ptr_cookie,
274 gt_handle_reorder reorder_fn)
275 {
276 struct ptr_data *data;
277
278 if (obj == NULL || obj == (void *) 1)
279 return;
280
281 data = htab_find_with_hash (saving_htab, obj, POINTER_HASH (obj));
282 if (data == NULL
283 || data->note_ptr_cookie != note_ptr_cookie)
284 abort ();
285
286 data->reorder_fn = reorder_fn;
287 }
288
289 /* Hash and equality functions for saving_htab, callbacks for htab_create. */
290
291 static hashval_t
292 saving_htab_hash (const void *p)
293 {
294 return POINTER_HASH (((struct ptr_data *)p)->obj);
295 }
296
297 static int
298 saving_htab_eq (const void *p1, const void *p2)
299 {
300 return ((struct ptr_data *)p1)->obj == p2;
301 }
302
303 /* Handy state for the traversal functions. */
304
305 struct traversal_state
306 {
307 FILE *f;
308 struct ggc_pch_data *d;
309 size_t count;
310 struct ptr_data **ptrs;
311 size_t ptrs_i;
312 };
313
314 /* Callbacks for htab_traverse. */
315
316 static int
317 call_count (void **slot, void *state_p)
318 {
319 struct ptr_data *d = (struct ptr_data *)*slot;
320 struct traversal_state *state = (struct traversal_state *)state_p;
321
322 ggc_pch_count_object (state->d, d->obj, d->size);
323 state->count++;
324 return 1;
325 }
326
327 static int
328 call_alloc (void **slot, void *state_p)
329 {
330 struct ptr_data *d = (struct ptr_data *)*slot;
331 struct traversal_state *state = (struct traversal_state *)state_p;
332
333 d->new_addr = ggc_pch_alloc_object (state->d, d->obj, d->size);
334 state->ptrs[state->ptrs_i++] = d;
335 return 1;
336 }
337
338 /* Callback for qsort. */
339
340 static int
341 compare_ptr_data (const void *p1_p, const void *p2_p)
342 {
343 struct ptr_data *p1 = *(struct ptr_data *const *)p1_p;
344 struct ptr_data *p2 = *(struct ptr_data *const *)p2_p;
345 return (((size_t)p1->new_addr > (size_t)p2->new_addr)
346 - ((size_t)p1->new_addr < (size_t)p2->new_addr));
347 }
348
349 /* Callbacks for note_ptr_fn. */
350
351 static void
352 relocate_ptrs (void *ptr_p, void *state_p)
353 {
354 void **ptr = (void **)ptr_p;
355 struct traversal_state *state ATTRIBUTE_UNUSED
356 = (struct traversal_state *)state_p;
357 struct ptr_data *result;
358
359 if (*ptr == NULL || *ptr == (void *)1)
360 return;
361
362 result = htab_find_with_hash (saving_htab, *ptr, POINTER_HASH (*ptr));
363 if (result == NULL)
364 abort ();
365 *ptr = result->new_addr;
366 }
367
368 /* Write out, after relocation, the pointers in TAB. */
369 static void
370 write_pch_globals (const struct ggc_root_tab * const *tab,
371 struct traversal_state *state)
372 {
373 const struct ggc_root_tab *const *rt;
374 const struct ggc_root_tab *rti;
375 size_t i;
376
377 for (rt = tab; *rt; rt++)
378 for (rti = *rt; rti->base != NULL; rti++)
379 for (i = 0; i < rti->nelt; i++)
380 {
381 void *ptr = *(void **)((char *)rti->base + rti->stride * i);
382 struct ptr_data *new_ptr;
383 if (ptr == NULL || ptr == (void *)1)
384 {
385 if (fwrite (&ptr, sizeof (void *), 1, state->f)
386 != 1)
387 fatal_error ("can't write PCH file: %m");
388 }
389 else
390 {
391 new_ptr = htab_find_with_hash (saving_htab, ptr,
392 POINTER_HASH (ptr));
393 if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f)
394 != 1)
395 fatal_error ("can't write PCH file: %m");
396 }
397 }
398 }
399
400 /* Hold the information we need to mmap the file back in. */
401
402 struct mmap_info
403 {
404 size_t offset;
405 size_t size;
406 void *preferred_base;
407 };
408
409 /* Write out the state of the compiler to F. */
410
411 void
412 gt_pch_save (FILE *f)
413 {
414 const struct ggc_root_tab *const *rt;
415 const struct ggc_root_tab *rti;
416 size_t i;
417 struct traversal_state state;
418 char *this_object = NULL;
419 size_t this_object_size = 0;
420 struct mmap_info mmi;
421 size_t page_size = getpagesize();
422
423 gt_pch_save_stringpool ();
424
425 saving_htab = htab_create (50000, saving_htab_hash, saving_htab_eq, free);
426
427 for (rt = gt_ggc_rtab; *rt; rt++)
428 for (rti = *rt; rti->base != NULL; rti++)
429 for (i = 0; i < rti->nelt; i++)
430 (*rti->pchw)(*(void **)((char *)rti->base + rti->stride * i));
431
432 for (rt = gt_pch_cache_rtab; *rt; rt++)
433 for (rti = *rt; rti->base != NULL; rti++)
434 for (i = 0; i < rti->nelt; i++)
435 (*rti->pchw)(*(void **)((char *)rti->base + rti->stride * i));
436
437 /* Prepare the objects for writing, determine addresses and such. */
438 state.f = f;
439 state.d = init_ggc_pch();
440 state.count = 0;
441 htab_traverse (saving_htab, call_count, &state);
442
443 mmi.size = ggc_pch_total_size (state.d);
444
445 /* Try to arrange things so that no relocation is necessary,
446 but don't try very hard. On most platforms, this will always work,
447 and on the rest it's a lot of work to do better. */
448 #if HAVE_MMAP_FILE
449 mmi.preferred_base = mmap (NULL, mmi.size,
450 PROT_READ | PROT_WRITE, MAP_PRIVATE,
451 fileno (state.f), 0);
452 if (mmi.preferred_base == (void *)-1)
453 mmi.preferred_base = NULL;
454 else
455 munmap (mmi.preferred_base, mmi.size);
456 #else /* HAVE_MMAP_FILE */
457 mmi.preferred_base = NULL;
458 #endif /* HAVE_MMAP_FILE */
459
460 ggc_pch_this_base (state.d, mmi.preferred_base);
461
462 state.ptrs = xmalloc (state.count * sizeof (*state.ptrs));
463 state.ptrs_i = 0;
464 htab_traverse (saving_htab, call_alloc, &state);
465 qsort (state.ptrs, state.count, sizeof (*state.ptrs), compare_ptr_data);
466
467 /* Write out all the scalar variables. */
468 for (rt = gt_pch_scalar_rtab; *rt; rt++)
469 for (rti = *rt; rti->base != NULL; rti++)
470 if (fwrite (rti->base, rti->stride, 1, f) != 1)
471 fatal_error ("can't write PCH file: %m");
472
473 /* Write out all the global pointers, after translation. */
474 write_pch_globals (gt_ggc_rtab, &state);
475 write_pch_globals (gt_pch_cache_rtab, &state);
476
477 ggc_pch_prepare_write (state.d, state.f);
478
479 /* Pad the PCH file so that the mmaped area starts on a page boundary. */
480 {
481 long o;
482 o = ftell (state.f) + sizeof (mmi);
483 if (o == -1)
484 fatal_error ("can't get position in PCH file: %m");
485 mmi.offset = page_size - o % page_size;
486 if (mmi.offset == page_size)
487 mmi.offset = 0;
488 mmi.offset += o;
489 }
490 if (fwrite (&mmi, sizeof (mmi), 1, state.f) != 1)
491 fatal_error ("can't write PCH file: %m");
492 if (mmi.offset != 0
493 && fseek (state.f, mmi.offset, SEEK_SET) != 0)
494 fatal_error ("can't write padding to PCH file: %m");
495
496 /* Actually write out the objects. */
497 for (i = 0; i < state.count; i++)
498 {
499 if (this_object_size < state.ptrs[i]->size)
500 {
501 this_object_size = state.ptrs[i]->size;
502 this_object = xrealloc (this_object, this_object_size);
503 }
504 memcpy (this_object, state.ptrs[i]->obj, state.ptrs[i]->size);
505 if (state.ptrs[i]->reorder_fn != NULL)
506 state.ptrs[i]->reorder_fn (state.ptrs[i]->obj,
507 state.ptrs[i]->note_ptr_cookie,
508 relocate_ptrs, &state);
509 state.ptrs[i]->note_ptr_fn (state.ptrs[i]->obj,
510 state.ptrs[i]->note_ptr_cookie,
511 relocate_ptrs, &state);
512 ggc_pch_write_object (state.d, state.f, state.ptrs[i]->obj,
513 state.ptrs[i]->new_addr, state.ptrs[i]->size);
514 if (state.ptrs[i]->note_ptr_fn != gt_pch_p_S)
515 memcpy (state.ptrs[i]->obj, this_object, state.ptrs[i]->size);
516 }
517 ggc_pch_finish (state.d, state.f);
518 gt_pch_fixup_stringpool ();
519
520 free (state.ptrs);
521 htab_delete (saving_htab);
522 }
523
524 /* Read the state of the compiler back in from F. */
525
526 void
527 gt_pch_restore (FILE *f)
528 {
529 const struct ggc_root_tab *const *rt;
530 const struct ggc_root_tab *rti;
531 size_t i;
532 struct mmap_info mmi;
533 void *addr;
534
535 /* Delete any deletable objects. This makes ggc_pch_read much
536 faster, as it can be sure that no GCable objects remain other
537 than the ones just read in. */
538 for (rt = gt_ggc_deletable_rtab; *rt; rt++)
539 for (rti = *rt; rti->base != NULL; rti++)
540 memset (rti->base, 0, rti->stride);
541
542 /* Read in all the scalar variables. */
543 for (rt = gt_pch_scalar_rtab; *rt; rt++)
544 for (rti = *rt; rti->base != NULL; rti++)
545 if (fread (rti->base, rti->stride, 1, f) != 1)
546 fatal_error ("can't read PCH file: %m");
547
548 /* Read in all the global pointers, in 6 easy loops. */
549 for (rt = gt_ggc_rtab; *rt; rt++)
550 for (rti = *rt; rti->base != NULL; rti++)
551 for (i = 0; i < rti->nelt; i++)
552 if (fread ((char *)rti->base + rti->stride * i,
553 sizeof (void *), 1, f) != 1)
554 fatal_error ("can't read PCH file: %m");
555
556 for (rt = gt_pch_cache_rtab; *rt; rt++)
557 for (rti = *rt; rti->base != NULL; rti++)
558 for (i = 0; i < rti->nelt; i++)
559 if (fread ((char *)rti->base + rti->stride * i,
560 sizeof (void *), 1, f) != 1)
561 fatal_error ("can't read PCH file: %m");
562
563 if (fread (&mmi, sizeof (mmi), 1, f) != 1)
564 fatal_error ("can't read PCH file: %m");
565
566 #if HAVE_MMAP_FILE
567 addr = mmap (mmi.preferred_base, mmi.size,
568 PROT_READ | PROT_WRITE, MAP_PRIVATE,
569 fileno (f), mmi.offset);
570 #else
571 addr = (void *)-1;
572 #endif
573 if (addr == (void *)-1)
574 {
575 addr = xmalloc (mmi.size);
576 if (fseek (f, mmi.offset, SEEK_SET) != 0
577 || fread (&mmi, mmi.size, 1, f) != 1)
578 fatal_error ("can't read PCH file: %m");
579 }
580 else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0)
581 fatal_error ("can't read PCH file: %m");
582
583 ggc_pch_read (f, addr);
584
585 if (addr != mmi.preferred_base)
586 {
587 for (rt = gt_ggc_rtab; *rt; rt++)
588 for (rti = *rt; rti->base != NULL; rti++)
589 for (i = 0; i < rti->nelt; i++)
590 {
591 char **ptr = (char **)((char *)rti->base + rti->stride * i);
592 if (*ptr != NULL)
593 *ptr += (size_t)addr - (size_t)mmi.preferred_base;
594 }
595
596 for (rt = gt_pch_cache_rtab; *rt; rt++)
597 for (rti = *rt; rti->base != NULL; rti++)
598 for (i = 0; i < rti->nelt; i++)
599 {
600 char **ptr = (char **)((char *)rti->base + rti->stride * i);
601 if (*ptr != NULL)
602 *ptr += (size_t)addr - (size_t)mmi.preferred_base;
603 }
604
605 sorry ("had to relocate PCH");
606 }
607
608 gt_pch_restore_stringpool ();
609 }
610
611 /* Modify the bound based on rlimits. Keep the smallest number found. */
612 static double
613 ggc_rlimit_bound (double limit)
614 {
615 #if defined(HAVE_GETRLIMIT)
616 struct rlimit rlim;
617 # ifdef RLIMIT_RSS
618 if (getrlimit (RLIMIT_RSS, &rlim) == 0
619 && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
620 && rlim.rlim_cur < limit)
621 limit = rlim.rlim_cur;
622 # endif
623 # ifdef RLIMIT_DATA
624 if (getrlimit (RLIMIT_DATA, &rlim) == 0
625 && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
626 && rlim.rlim_cur < limit)
627 limit = rlim.rlim_cur;
628 # endif
629 # ifdef RLIMIT_AS
630 if (getrlimit (RLIMIT_AS, &rlim) == 0
631 && rlim.rlim_cur != (rlim_t) RLIM_INFINITY
632 && rlim.rlim_cur < limit)
633 limit = rlim.rlim_cur;
634 # endif
635 #endif /* HAVE_GETRLIMIT */
636
637 return limit;
638 }
639
640 /* Heuristic to set a default for GGC_MIN_EXPAND. */
641 int
642 ggc_min_expand_heuristic (void)
643 {
644 double min_expand = physmem_total();
645
646 /* Adjust for rlimits. */
647 min_expand = ggc_rlimit_bound (min_expand);
648
649 /* The heuristic is a percentage equal to 30% + 70%*(RAM/1GB), yielding
650 a lower bound of 30% and an upper bound of 100% (when RAM >= 1GB). */
651 min_expand /= 1024*1024*1024;
652 min_expand *= 70;
653 min_expand = MIN (min_expand, 70);
654 min_expand += 30;
655
656 return min_expand;
657 }
658
659 /* Heuristic to set a default for GGC_MIN_HEAPSIZE. */
660 int
661 ggc_min_heapsize_heuristic (void)
662 {
663 double min_heap_kbytes = physmem_total();
664
665 /* Adjust for rlimits. */
666 min_heap_kbytes = ggc_rlimit_bound (min_heap_kbytes);
667
668 min_heap_kbytes /= 1024; /* convert to Kbytes. */
669
670 /* The heuristic is RAM/8, with a lower bound of 4M and an upper
671 bound of 128M (when RAM >= 1GB). */
672 min_heap_kbytes /= 8;
673 min_heap_kbytes = MAX (min_heap_kbytes, 4 * 1024);
674 min_heap_kbytes = MIN (min_heap_kbytes, 128 * 1024);
675
676 return min_heap_kbytes;
677 }
678
679 void
680 init_ggc_heuristics (void)
681 {
682 #ifndef ENABLE_GC_ALWAYS_COLLECT
683 set_param_value ("ggc-min-expand", ggc_min_expand_heuristic());
684 set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic());
685 #endif
686 }