We had a question from a user who had turned on memory debugging in TotalView
and experience a memory event error Invalid memory alignment request. Having a
1.3.3 build of OpenMPI handy, I tested it and sure enough, saw the error. I
traced it down to, surprise, a call to memalign. I find there are a few places
where memalign is called, but the one I think I was dealing with was from
malloc.c in ompi/mca//io/romio/romio/adio/common in the following lines:
#ifdef ROMIO_XFS
new = (void *) memalign(XFS_MEMALIGN, size);
#else
new = (void *) malloc(size);
#endif
I searched, but couldn't find a value for XFS_MEMALIGN, so maybe it was from
opal_pt_malloc2_component.c instead, where the call is
p = memalign(1, 1024 * 1024);
There are only 10 to 12 references to memalign in the code that I can see, so it
shouldn't be too hard to find. What I can tell you is that the value that
TotalView saw for alignment, the first arg, was 1, and the second, the size, was
0x100000, which is probably right for 1024 squared.
The man page for memalign says that the first argument is the alignment that the
allocated memory use, and it must be a power of two. The second is the length
you want allocated. One could argue that 1 is a power of two, but it seems a
bit specious to me, and TotalView's memory debugger certainly objects to it.
Can anyone tell me what the intent here is, and whether the memalign alignment
argument is thought to be valid? Or is this a bug (that might not affect anyone
other than TotalView memory debug users?)
Thanks,
Peter Thompson