[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #37148] memory pool content is being corrupted after m
[lwip-devel] [bug #37148] memory pool content is being corrupted after memp_free()
Thu, 23 Aug 2012 04:50:42 +0000
Opera/9.80 (Windows NT 6.1; WOW64; U; ru) Presto/2.10.289 Version/12.01
Follow-up Comment #2, bug #37148 (project lwip):
Ok. If you claim that lwip pools designed to hold only memory and don't care
about contents then I have to agree that I use them in wrong way and this bug
report is invalid and should be closed.
I'll correct my statement: it makes impossible to use custom defined pools to
preallocate *initialized* system objects.
FreeRTOS allocates object on it's own heap which could be implemented by user.
There are three implementations already provided and all of them will cause
heap to be fragmented. That's why I have to create objects at start-up and
keep their handles (pointers) in pool for reuse. What do you recommend to
solve this problem *gracefully* ?
> Why is pool content overwritten?
See, 'mem' argument points to memory which holds initialized data. Then 'memp'
is being assigned to point exactly to the same memory since MEMP_SIZE=0. It's
just typecasted and nothing more. Finaly, 'memp->next' assignment rewrites
I considered this as a bug because I thought that MEMP_SIZE is provided to
shift pointer at least for sizeof(struct memp) before data. But somebody
(likely other person) forget about memp_free() and defined MEMP_SIZE value as
zero. Moreover, it will corrupt neighbour memory contents on platforms where
pointer size exceeds minimum size allowed for lwip pool element.
Reply to this item at:
Message sent via/by Savannah