Commit 4326986c authored by jan.koester's avatar jan.koester
Browse files

Merge branch 'gtk-desktop': 16-byte malloc block header on 32-bit targets

parents c2a8bc55 70aadeca
Loading
Loading
Loading
Loading
+6 −0
Changes for src/linux/alloc.cpp: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -111,8 +111,14 @@ namespace sys {
                union {
                    unsigned long size;        /* valid while allocated: real usable byte size, for size_of() */
                    block_header* next_free;   /* valid while free (pooled blocks only): next node on this size class's free list */
                    /* keeps the header at 16 bytes on 32-bit targets too: with a
                     * 4-byte long it was 12, every block 16n+12 and malloc()'s
                     * pointers only 4-aligned -- below ppc's alignof(double) and
                     * max_align_t of 8 (GObject's g_object_is_aligned() aborted) */
                    uint64_t _pad;
                };
            };
            static_assert(sizeof(block_header) == 16, "malloc() alignment relies on a 16-byte block header");

            static constexpr unsigned NUM_CLASSES = 13;
            static constexpr unsigned long SLAB_SIZE = 256 * 1024;