1 /* 7zAlloc.c -- Allocation functions
2 2017-04-03 : Igor Pavlov : Public domain */
10 /* #define _SZ_ALLOC_DEBUG */
11 /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
13 #ifdef _SZ_ALLOC_DEBUG
21 int g_allocCountTemp
= 0;
25 void *SzAlloc(ISzAllocPtr p
, size_t size
)
30 #ifdef _SZ_ALLOC_DEBUG
31 fprintf(stderr
, "\nAlloc %10u bytes; count = %10d", (unsigned)size
, g_allocCount
);
37 void SzFree(ISzAllocPtr p
, void *address
)
40 #ifdef _SZ_ALLOC_DEBUG
44 fprintf(stderr
, "\nFree; count = %10d", g_allocCount
);
50 void *SzAllocTemp(ISzAllocPtr p
, size_t size
)
55 #ifdef _SZ_ALLOC_DEBUG
56 fprintf(stderr
, "\nAlloc_temp %10u bytes; count = %10d", (unsigned)size
, g_allocCountTemp
);
59 return HeapAlloc(GetProcessHeap(), 0, size
);
65 void SzFreeTemp(ISzAllocPtr p
, void *address
)
68 #ifdef _SZ_ALLOC_DEBUG
72 fprintf(stderr
, "\nFree_temp; count = %10d", g_allocCountTemp
);
75 HeapFree(GetProcessHeap(), 0, address
);