fprintf (G.debug_file, "Deallocating object, chunk=%p\n", (void *)chunk);
}
+/* For a given size of memory requested for allocation, return the
+ actual size that is going to be allocated. */
+
+size_t
+ggc_round_alloc_size (size_t requested_size)
+{
+ size_t size;
+
+ /* Make sure that zero-sized allocations get a unique and freeable
+ pointer. */
+ if (requested_size == 0)
+ size = MAX_ALIGNMENT;
+ else
+ size = (requested_size + MAX_ALIGNMENT - 1) & -MAX_ALIGNMENT;
+
+ return size;
+}
+
/* Allocate a chunk of memory of at least ORIG_SIZE bytes, in ZONE. */
void *
struct small_page_entry *entry;
struct alloc_chunk *chunk, **pp;
void *result;
- size_t size = orig_size;
-
- /* Make sure that zero-sized allocations get a unique and freeable
- pointer. */
- if (size == 0)
- size = MAX_ALIGNMENT;
- else
- size = (size + MAX_ALIGNMENT - 1) & -MAX_ALIGNMENT;
+ size_t size = ggc_alloced_size_for_request (orig_size);
/* Try to allocate the object from several different sources. Each
of these cases is responsible for setting RESULT and SIZE to