Reputation: 25
I have a base class and a derived class. Things work well with this setup. I have added another class in base class, so its a nested class. On allocation of memory for the new nested class, I see some memory corruption. I want to know when we have nested class, does the size of base class increase ?
Upvotes: 0
Views: 220
Reputation: 4363
Odds are the changes are hiding an application code problem, just as certain memory bugs don't corrupt a running process the same way when run under a debugger, which also changes the environment.
mallopt
is used to frob the value however, with this doc:
MALLOC_ARENA_SIZE
The size of the arena, a chunk of memory that the memory allocator allocates
and deallocates from the system. This value must be a multiple of 4 KB, and
currently is limited to being less than 256 KB. Environment variable:
MALLOC_ARENA_SIZE.
But like I said, if changes this looks like it fixes the corruption, don't believe it. Better to set the arena size to whatever value exposes the application bug, then fix the bug itself.
Upvotes: 1