Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - QNX6.5.0 SP1 problem with posix_memalign.: (3 Items)
   
QNX6.5.0 SP1 problem with posix_memalign.  
In QNX6. 5.0SP1 appears mistake in posix_memalign. 
Test program 
# cat Test.c
#include <stdlib.h>
int main(int argc, char **argv)
{
        void *ptr = 0;
        posix_memalign(&ptr, 16, 16 - 2 * sizeof (void*));
        posix_memalign(&ptr, 32, 32 - 2 * sizeof (void*));
        posix_memalign(&ptr, 64, 64 - 2 * sizeof (void*));
        posix_memalign(&ptr, 128, 128 - 2 * sizeof (void*));
        return (0);
}
# gcc -g -o Test Test.c

After starting - ./Test  the program is standing in the STATE = RUNNIG state.
This state is caused by:
posix_memalign(&ptr, 128, 128 - 2 * sizeof (void*));
# gdb Test
GNU gdb 6.8 qnx-nto (rev. 506)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-pc-nto-qnx6.5.0"...
(gdb) start
Temporary breakpoint 1 at 0x8048699: file Test.c, line 4.
Starting program: /root/Test0
[New pid 2007084 tid 1]

Temporary breakpoint 1, main (argc=1, argv=0x8047a04) at Test.c:4
4               void *ptr = 0;
(gdb) n
5               posix_memalign(&ptr, 16, 16 - 2 * sizeof (void*));
(gdb)
6               posix_memalign(&ptr, 32, 32 - 2 * sizeof (void*));
(gdb)
7               posix_memalign(&ptr, 64, 64 - 2 * sizeof (void*));
(gdb)
8               posix_memalign(&ptr, 128, 128 - 2 * sizeof (void*));
(gdb)     <= and  the program is standing in this place in the RUNNIG state 
              <=  After the interrupt  - Ctrl C 
Program received signal SIGINT, Interrupt.
0xb032799f in _band_get_aligned () from /usr/qnx650/target/qnx6/x86/lib/libc.so.3
(gdb) q
The program is running.  Exit anyway? (y or n) y
# 

I think that the problem lies in the function _band_get_aligned  from libc.


 
Re: QNX6.5.0 SP1 problem with posix_memalign.  
Thanks for the report, it's been addressed and if you have a priority
support plan you can request a hotfix using reference #179337.

In the meantime you can work around the issue by setting your bin sizes as
such:
MALLOC_BAND_CONFIG_STR="8:16,32,0:24,32,0:32,32,0:48,24,0:64,24,0:80,24,0:9
6,16,0:128,8,0"

And exporting that environment variable or setting the same parameters via
mallopt().


--
Adam Mallory (amallory@qnx.com)





On 12-07-14 5:59 AM, "bogdan celer" <community-noreply@qnx.com> wrote:

>In QNX6. 5.0SP1 appears mistake in posix_memalign.
>Test program 
># cat Test.c
>#include <stdlib.h>
>int main(int argc, char **argv)
>{
>        void *ptr = 0;
>        posix_memalign(&ptr, 16, 16 - 2 * sizeof (void*));
>        posix_memalign(&ptr, 32, 32 - 2 * sizeof (void*));
>        posix_memalign(&ptr, 64, 64 - 2 * sizeof (void*));
>        posix_memalign(&ptr, 128, 128 - 2 * sizeof (void*));
>        return (0);
>}
># gcc -g -o Test Test.c
>
>After starting - ./Test  the program is standing in the STATE = RUNNIG
>state.
>This state is caused by:
>posix_memalign(&ptr, 128, 128 - 2 * sizeof (void*));
># gdb Test
>GNU gdb 6.8 qnx-nto (rev. 506)
>Copyright (C) 2008 Free Software Foundation, Inc.
>License GPLv3+: GNU GPL version 3 or later
><http://gnu.org/licenses/gpl.html>;
>This is free software: you are free to change and redistribute it.
>There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
>and "show warranty" for details.
>This GDB was configured as "i486-pc-nto-qnx6.5.0"...
>(gdb) start
>Temporary breakpoint 1 at 0x8048699: file Test.c, line 4.
>Starting program: /root/Test0
>[New pid 2007084 tid 1]
>
>Temporary breakpoint 1, main (argc=1, argv=0x8047a04) at Test.c:4
>4               void *ptr = 0;
>(gdb) n
>5               posix_memalign(&ptr, 16, 16 - 2 * sizeof (void*));
>(gdb)
>6               posix_memalign(&ptr, 32, 32 - 2 * sizeof (void*));
>(gdb)
>7               posix_memalign(&ptr, 64, 64 - 2 * sizeof (void*));
>(gdb)
>8               posix_memalign(&ptr, 128, 128 - 2 * sizeof (void*));
>(gdb)     <= and  the program is standing in this place in the RUNNIG
>state 
>              <=  After the interrupt  - Ctrl C
>Program received signal SIGINT, Interrupt.
>0xb032799f in _band_get_aligned () from
>/usr/qnx650/target/qnx6/x86/lib/libc.so.3
>(gdb) q
>The program is running.  Exit anyway? (y or n) y
># 
>
>I think that the problem lies in the function _band_get_aligned  from
>libc.
>
>
> 
>
>
>
>_______________________________________________
>
>OSTech
>http://community.qnx.com/sf/go/post94257
>To cancel your subscription to this discussion, please e-mail
>ostech-core_os-unsubscribe@community.qnx.com

Re: QNX6.5.0 SP1 problem with posix_memalign.  
Adam thanks.  
It works very well. 
bogdan