Hi all,
I have problem by allocating a memory for my objects. Assuming this lines
1- object* test;
2- test = new object ;
3- test->Attribute = true
4- ....
5- delete test;
if i repeat this code several times then I get error by allocating the memory in line 2
The error that i got is:
test-project: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
May someone clarify me why the simulation will be failed by allocating memory through new operator?
thanks in advance..
Last edited on
The code you've posted seems ok, assuming that object has a member, Attribute which is an integral type.
You most probably have an error in code you haven't posted.
Please post some of the code. Its easy to miss inadvertent memory leaks.