[dpdk-users] rte_zmalloc() returning non-zeroed memory on FreeBSD
Verkamp, Daniel
daniel.verkamp at intel.com
Thu Aug 11 01:39:03 CEST 2016
On Wed, 2016-08-10 at 23:30 +0000, Verkamp, Daniel wrote:
> I've attached a minimized reproducer
> program - running it twice in a row fails reliably for me.
It seems the attachment got stripped, so here it is inline:
#include <stdio.h>
#include <rte_config.h>
#include <rte_eal.h>
#include <rte_malloc.h>
int main(int argc, char **argv)
{
unsigned char *buf;
int i;
size_t size = 5200;
rte_eal_init(argc, argv);
buf = rte_zmalloc("test", size, 64);
printf("Got buf %p\n", buf);
for (i = 0; i < size; i++) {
if (buf[i] != 0) {
printf("byte %d is %x\n", i, buf[i]);
return 1;
}
}
printf("All bytes cleared\n");
printf("Writing garbage\n");
for (i = 0; i < size; i++) {
buf[i] = 0x5A;
}
return 0;
}
More information about the users
mailing list