diff --git a/utils/ihash.c b/utils/ihash.c index e6f8c7ef..9896431c 100644 --- a/utils/ihash.c +++ b/utils/ihash.c @@ -276,8 +276,8 @@ int IHashStats2(IHashTable *table, if(nEntries) *nEntries = table->iht_nEntries; return - UtlsStatMallocMem(sizeof(IHashTable)) + - UtlsStatMallocMem(sizeof(void *)* table->iht_nBuckets); + IHashAlignedSize(sizeof(IHashTable)) + + IHashAlignedSize(sizeof(void *)* table->iht_nBuckets); } /* hash for key fields that are pointers to strings */ diff --git a/utils/ihash.h b/utils/ihash.h index 5d9faabb..91c0dc4a 100644 --- a/utils/ihash.h +++ b/utils/ihash.h @@ -42,6 +42,16 @@ #ifndef _IHASH_H #define _IHASH_H +/* returns total memory required for malloc of given size, for */ +/* routine IHashStat2() only. */ + +static __inline__ int IHashAlignedSize(int size) +{ + int result; + /* Expand size to be double-word (64 bit) aligned */ + result = ((size + 7) / 8) * 8; +} + /* The IHashTable struct should not be manipulated directly by clients */ typedef struct ihashtable