Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

test.c File Reference

#include <stdio.h>
#include "rtl_malloc.h"

Include dependency graph for test.c:

Go to the source code of this file.

Defines

#define KiloByte   1024
#define POOL_SIZE   1024

Functions

 main ()

Variables

char pool [POOL_SIZE *KiloByte]


Define Documentation

#define KiloByte   1024
 

Definition at line 4 of file test.c.

#define POOL_SIZE   1024
 

Definition at line 5 of file test.c.

Referenced by main().


Function Documentation

main  ) 
 

Definition at line 12 of file test.c.

References associate_buffer, destroy_memory_pool(), init_memory_pool(), pool, POOL_SIZE, rtl_free, and rtl_malloc.

00012       {
00013     int *ptr[100];
00014     int i, free_mem;
00015 
00016     free_mem = init_memory_pool(POOL_SIZE, 5, pool);
00017     printf("Total free memory= %d\n", free_mem);
00018 
00019     // default malloc and free use this buffer.
00020     associate_buffer(pool);
00021 
00022 
00023     for (i=0; i< 100; i++)
00024         if (!(ptr[i]=rtl_malloc(100))){
00025             printf("Error\n");
00026             exit(-1);
00027         }
00028 
00029     for (i=0; i< 100; i++)
00030         rtl_free(ptr[i]);
00031 
00032 
00033     destroy_memory_pool(pool);
00034     printf("Test OK\n");
00035     exit(0);
00036 }

Here is the call graph for this function:


Variable Documentation

char pool[POOL_SIZE*KiloByte]
 

Definition at line 9 of file test.c.

Referenced by main().


Generated on Wed Jan 14 12:59:15 2004 for RTL-lwIP-0.4 by doxygen 1.3.4