Thu 23 Aug 2012 06:02:44 AM UTC, comment #3:
> See, 'mem' argument points to memory which holds initialized data.
Yes, it's now clear that this is your actual problem, and I don't think anyone has tried to do that before or there would have been bug reports already.
> But somebody (likely other person)
I think that was me (some years ago).
> forget about memp_free() and defined MEMP_SIZE value as zero.
That was not an error but an intentional decision to save memory and reuse the data part to keep the linked list pointers - this works because the data part is only used when allocated and the linked list pointer is only used when deallocated.
> Moreover, it will corrupt neighbour memory contents on platforms
> where pointer size exceeds minimum size allowed for lwip pool
> element.
I think this can only happen when MEM_ALIGNMENT is not defined correctly. You might be correct though that this wouldn't work on a platform where you don't want/need memory alginment but pointers are big. However, this is a rather theoretical issue, given the fact that lwIP does not have pool items that small...
> What do you recommend to solve this problem gracefully ?
I can't recommend anything right now to solve this gracefully besides adding another config option to support something that lwIP has not yet been designed to do.
|