aos/usr/mallocator/main.c
2022-04-11 00:16:14 +02:00

33 lines
815 B
C

/**
* \file
* \brief process that allocates some memory to test page faulting and page mapping
*/
/*
* Copyright (c) 2016, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
*/
#include <stdio.h>
#include <stdlib.h>
#include <aos/aos.h>
#include <aos/paging.h>
int main(int argc, char *argv[])
{
//allocate a 256 byte buffer
// char * small_buf = malloc(256);
// small_buf[0] = 'a';
//allocate a 256 MiB buffer
char * big_buf = malloc(1<<28);
big_buf[0] = 'a';
for (int i = 0; i < (1 << 14); i += 4096) {
printf("%x\n", i);
big_buf[i] = 'b';
}
}