Ignore:
Timestamp:
Jan 6, 2002, 5:48:47 PM (24 years ago)
Author:
sandervl
Message:

Heap(Re)Alloc changes: allocate in multiples of 8 bytes and allow the memory block to grow to this boundary with HeapReAlloc before returning a new pointer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/os2heap.h

    r7360 r7728  
    1 /* $Id: os2heap.h,v 1.10 2001-11-16 14:52:56 phaller Exp $ */
     1/* $Id: os2heap.h,v 1.11 2002-01-06 16:48:47 sandervl Exp $ */
    22
    33/*
     
    1919
    2020#define MAGIC_NR_HEAP  0x87654321
    21 //must be a multiple of 8 bytes (alignment)
     21//must be a multiple of 8 bytes (alignment)!!
    2222typedef struct _tagHEAPELEM {
    2323  DWORD  magic;     //magic number
    2424  LPVOID lpMem;     //pointer returned by malloc
     25  DWORD  cursize;   //current size (HeapReAlloc changes this)
     26  DWORD  orgsize;   //size used to allocate this memory block
    2527} HEAPELEM;
    2628
    27 //+8 to make sure we can align the pointer at 8 byte boundary
    28 #define HEAP_OVERHEAD (sizeof(HEAPELEM)+8)
     29#define HEAP_ALIGNMENT          8
     30#define HEAP_ALIGNMENT_MASK     (~7)
     31
     32#define HEAP_OVERHEAD (sizeof(HEAPELEM))
     33
     34#define HEAP_ALIGN(a)     (((DWORD)a+HEAP_ALIGNMENT-1) & HEAP_ALIGNMENT_MASK)
    2935
    3036#define GET_HEAPOBJ(ptr) (HEAPELEM *)((char *)ptr - sizeof(HEAPELEM));
Note: See TracChangeset for help on using the changeset viewer.