1 /* 7zAlloc.c -- Allocation functions
2 2010-10-29 : Igor Pavlov : Public domain */
6 /* #define _SZ_ALLOC_DEBUG */
7 /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
17 int g_allocCountTemp
= 0;
21 void *SzAlloc(void *p
, size_t size
)
26 #ifdef _SZ_ALLOC_DEBUG
27 fprintf(stderr
, "\nAlloc %10d bytes; count = %10d", size
, g_allocCount
);
33 void SzFree(void *p
, void *address
)
36 #ifdef _SZ_ALLOC_DEBUG
40 fprintf(stderr
, "\nFree; count = %10d", g_allocCount
);
46 void *SzAllocTemp(void *p
, size_t size
)
51 #ifdef _SZ_ALLOC_DEBUG
52 fprintf(stderr
, "\nAlloc_temp %10d bytes; count = %10d", size
, g_allocCountTemp
);
55 return HeapAlloc(GetProcessHeap(), 0, size
);
61 void SzFreeTemp(void *p
, void *address
)
64 #ifdef _SZ_ALLOC_DEBUG
68 fprintf(stderr
, "\nFree_temp; count = %10d", g_allocCountTemp
);
71 HeapFree(GetProcessHeap(), 0, address
);