Re: Bug#487745: epiphany-webkit: crashes on startup
On Tue, Jun 24, 2008 at 08:44:23AM +0200, Mike Hommey wrote:
> Or maybe something like this:
> index 8afc70d..496d1ee 100644
> @@ -1820,7 +1820,7 @@ static TCMalloc_Central_FreeListPadded central_cache[kNumClasses];
> // Page-level allocator
> static SpinLock pageheap_lock = SPINLOCK_INITIALIZER;
> -static void* pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(void*) - 1) / sizeof(void*)];
> +static uint64_t* pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(uint64_t*) - 1) / sizeof(uint64_t*)];
> static bool phinited = false;
All pointers are the same size and have the same alignment requirements, so
this change doesn't force the compiler to change make pageheap_memory aligned
on 8 bytes. I'm probably missing some trick (not very familiar with C++), but why
not just do:
static TCMalloc_PageHeap pageheap_memory;
static inline TCMalloc_PageHeap* getPageHeap()
> Where pageheap is a macro for getPageHeap(). So what is actually not
> 64-bit aligned is not allocated through the a dynamic allocator...
> So, I'd say forcing this to be 64-bit aligned should be enough, and the
> above diff should be doing just this.
Forcing the compiler to allign the memory to whatever has the biggest alignment
requirement in the class should fix the problem indeed.
In the next world, you're on your own.