Files
RedBear-OS/tests/stdlib/alloc.c
T
Jeremy Soller 950b4526c7 - Disable output of empty header files
- Remove incorrect header styles
- Use export.replace where header style was previously needed
- Check compilation of tests using system gcc
2018-11-26 21:35:02 -07:00

30 lines
589 B
C

#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char ** argv) {
char * ptr = (char *)malloc(256);
printf("malloc %p\n", ptr);
int i;
for(i = 0; i < 256; i++) {
ptr[i] = (char)i;
}
free(ptr);
char * ptrc = (char *)calloc(256, 1);
printf("calloc %p\n", ptrc);
for(i = 0; i < 256; i++) {
ptrc[i] = (char)i;
}
free(ptrc);
char * ptra = (char *)memalign(256, 256);
printf("memalign %p\n", ptra);
for(i = 0; i < 256; i++) {
ptra[i] = (char)i;
}
free(ptra);
return 0;
}