This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Malloc debug upsets alignment


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.

If / when I get a fix I'll post again -- if / when somebody else fixes
this I would appreciate a post.  Thanks!


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]