|
From: Andriy R. <ar...@bc...> - 2003-11-27 22:35:13
|
test.c:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char* p = 0;
int ret = posix_memalign(&p, 16, 800*600*3/2);
printf("ret %d, p %p\n", ret, p);
return 0;
}
# ./test
ret 0, p 0xbf4f8020
# valgrind ./test
==28692== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==28692== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==28692== Using valgrind-2.0.0, a program supervision framework for
x86-linux.
==28692== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==28692== Estimated CPU clock rate is 2025 MHz
==28692== For more details, rerun with: -v
==28692==
ret 22, p (nil)
==28692==
==28692== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==28692== malloc/free: in use at exit: 0 bytes in 0 blocks.
==28692== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==28692== For a detailed leak analysis, rerun with: --leak-check=yes
==28692== For counts of detected errors, rerun with: -v
this is valgrind 2.0.0 with posix_memalign patch:
# define weak_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
weak_alias(__posix_memalign, posix_memalign);
Andriy
Nicholas Nethercote wrote:
>On Tue, 25 Nov 2003, Andriy Rysin wrote:
>
>
>
>>sorry, just found out that this patch breaks posix_memalign. It was ok
>>for that small example but when I tried valgrind on my bigger project it
>>seems like posix_memalign sets pointer to 0 and returns 22 (EINVAL),
>>while valgrind w/out this patch or just w/valgrind altogether code works
>>fine.
>>I did not have much time to investigate it more, I allocate about
>>800*600*3/2 with align 16.
>>If more info needed I'll try to take a look when it breaks.
>>
>>
>
>That would help, thanks.
>
>N
>
>
|