32 lines
611 B
C
32 lines
611 B
C
#include "nms.h"
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
|
|
int main(void)
|
|
{
|
|
void * ret;
|
|
|
|
nms_init(1);
|
|
// duplicate init
|
|
nms_init(1);
|
|
|
|
// 1G
|
|
ret = nms_malloc(0, 1024 * 1024 * 1024);
|
|
assert(ret != NULL);
|
|
printf("1G: %p\n", ret);
|
|
|
|
// two 511Ms
|
|
ret = nms_malloc(0, 511 * 1024 * 1024);
|
|
assert(ret != NULL);
|
|
printf("511M: %p\n", ret);
|
|
ret = nms_malloc(0, 511 * 1024 * 1024);
|
|
assert(ret != NULL);
|
|
printf("511M: %p\n", ret);
|
|
|
|
// another 1G
|
|
ret = nms_malloc(0, 1024 * 1024 * 1024);
|
|
assert(ret != NULL);
|
|
printf("1G: %p\n", ret);
|
|
|
|
return 0;
|
|
} |