PRUint64 nsTransformedTextRun::ComputeSize() { PRUint32 total = gfxTextRun::ComputeSize(); if (moz_malloc_usable_size(this) == 0) { total += sizeof(nsTransformedTextRun) - sizeof(gfxTextRun); } total += mStyles.SizeOf(); total += mCapitalize.SizeOf(); if (mOwnsFactory) { PRUint32 factorySize = moz_malloc_usable_size(mFactory); if (factorySize == 0) { // this may not quite account for everything // (e.g. nsCaseTransformTextRunFactory adds a couple of members) // but I'm not sure it's worth the effort to track more precisely factorySize = sizeof(nsTransformingTextRunFactory); } total += factorySize; } return total; }
static inline bool TestOne(size_t size) { size_t req = size; size_t adv = malloc_good_size(req); char* p = (char*)malloc(req); size_t usable = moz_malloc_usable_size(p); if (adv != usable) { fail("malloc_good_size(%d) --> %d; " "malloc_usable_size(%d) --> %d", req, adv, req, usable); return false; } free(p); return true; }
void HunspellReportMemoryDeallocation(void* ptr) { gHunspellAllocatedSize -= moz_malloc_usable_size(ptr); }
size_t moz_malloc_size_of(const void *ptr) { return moz_malloc_usable_size((void *)ptr); }