Dave Lawrence wrote: > Hi > > If CYGDBG_MEMALLOC_MALLOC_DEBUG_GUARDS is set then an 8 byte offset is > added to the start of the buffer. Therefore if > CYGNUM_MEMALLOC_ALLOCATOR_DLMALLOC_ALIGNMENT is > 3 the returned pointer > is guaranteed to not be aligned the way you expect it. > > eg if the alignment specified is 6, one expects that (ptr % 64 == 0) > whereas the actual truth is that ((ptr - 8) % 64 == 0). ["ptr" being the > return value of malloc, in this context] > > Having an unexpected alignment can, amongst other things, reduce the > performance of DMA engines and defeat your cache coherency strategy. > > I would like to fix this but don't have time at the moment - switching > the debug guards off is an acceptable work around for me.
Well spotted. The issue there is that CYGNUM_MEMALLOC_ALLOCATOR_DLMALLOC_ALIGNMENT is specific to the dlmalloc implementation, whereas CYGDBG_MEMALLOC_MALLOC_DEBUG_GUARDS wraps the malloc implementation, whatever underlying implementation that actually is, so isn't aware of that. Although it's more wasteful of memory, it's probably best to up MG_HEAD_SIZE. I'll do something about that in the master sources. > If / when I get a fix I'll post again -- if / when somebody else fixes > this I would appreciate a post. Thanks! Public eCos doesn't have any of the heap debug and analysis support, it's eCosPro only. Jifl -- eCosCentric Limited http://www.eCosCentric.com/ The eCos experts Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571 Registered in England and Wales: Reg No 4422071. ------["Si fractum non sit, noli id reficere"]------ Opinions==mine -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
