--- a/src/hbcore/core/hbsharedmemoryallocators_p.h Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/core/hbsharedmemoryallocators_p.h Fri Sep 17 08:32:10 2010 +0300
@@ -39,10 +39,11 @@
static const int MAXIMUM_ALLOC_SIZE_FOR_SUBALLOCATOR = 224;
// used to identify memory allocated by main or sub allocator
-// if metadata (integer just before allocated data) & MAIN_ALLOCATOR_IDENTIFIER
+// if metadata (qptrdiff just before allocated data) & MAIN_ALLOCATOR_IDENTIFIER
// == true, data was allocated using main allocator, otherwise suballocator
-// was used
-static const int MAIN_ALLOCATOR_IDENTIFIER = 0x80000000;
+// was used. This works because suballocator saves aligned offsets to metadata and
+// they can't be odd.
+static const qptrdiff MAIN_ALLOCATOR_IDENTIFIER = 1;
// max. amount of different chunk sizes in multisegment allocator
static const int AMOUNT_OF_DIFFERENT_CHUNK_SIZES = 8;
@@ -128,12 +129,12 @@
TreeNode pointerNode;
quintptr next;
quintptr prev;
- int allocatorIdentifier;
+ qptrdiff allocatorIdentifier;
};
struct HeapHeader
{
- quintptr identifier;
+ quint32 identifier;
quintptr lengthNode;
quintptr pointerNode;
int freeBytes;
@@ -184,7 +185,7 @@
private:
struct MultiAllocatorHeader
{
- quintptr identifier;
+ quint32 identifier;
// always points to the first list
qptrdiff offsetsToChunkLists[AMOUNT_OF_DIFFERENT_CHUNK_SIZES];
// always points to the list with free chunks