Forum Discussion
Altera_Forum
Honored Contributor
21 years agomalloc( )problem
Hello : data_written = (unsigned char *)malloc(0x1000); num=sizeof(data_written); The size of data_written should be 0x1000,But use the function sizeof,the num is 4 . I hav...
Altera_Forum
Honored Contributor
21 years agoIt looks as though there is a bug in memtest.c here. Please replace sizeof(data_written) with 0x1000 for correct behaviour.
The C standard says that the contents of memory returned with malloc is undefined. Some systems zero it for you, but some do not. You should use memset to zero it yourself if that's what you need (or fill it with a known pattern as this code attempts to).