source: svn/trunk/newcon3bcm2_21bu/dst/dhl/api/test/OSHeapTest.c

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 1.1 KB
RevLine 
[2]1/*
2        OSHeapTest.c
3*/
4
5#include "DHL_OSAL.h"
6
7/*
8        ¸Þ¸ð¸® ÇÒ´çÀ» À§ÇÑ º¯¼ö¸¦ ¼±¾ðÇϰí
9        ¸Þ¸ð¸® ÇÒ´ç ÀüÈÄÀÇ ÁÖ¼Ò È®ÀÎ
10        ¸Þ¸ð¸® ¹Ýȯ ÈÄÀÇ ÁÖ¼Ò È®ÀÎ
11
12        °á°ú : pMemÀÇ ÁÖ¼Ò°¡ 0x0 -> 0xXXXXXXXX -> 0x0 ¼ø¼­·Î Ãâ·ÂµÇ¸é Á¤»ó
13*/
14
15#define TEST_MALLOC_SIZE 1024
16
17void OS_HeapTest(void)
18{       
19        int* pMem = 0;
20        DHL_OS_HEAP_STATUS status;
21
22
23        DHL_OS_Printf( "\r\n----OS Heap Test----\r\n\r\n");
24
25        DHL_OS_GetHeapStatus(&status);
26        DHL_OS_Printf("size_heap = %x, num_alloc_chunk = %x, size_alloc = %x num_free_chunk=%x, size_free=%x \n",
27                      status.size_heap, status.num_alloc_chunk,
28                      status.size_alloc, status.num_free_chunk, status.size_free);                                                                                                                                                                                                             
29
30
31        DHL_OS_Printf( "The value of \'pMem\' before malloc is 0x%x\r\n", pMem);
32
33
34        pMem = DHL_OS_Malloc(TEST_MALLOC_SIZE);
35
36        DHL_OS_Printf( "The value of \'pMem\' after malloc is 0x%x\r\n", pMem);
37
38        if (pMem == 0)
39                DHL_OS_Printf( "Malloc is failed..\r\n");
40
41
42        DHL_OS_Free((void**)&pMem);
43
44        DHL_OS_Printf("The value of \'pMem\' after free.. 0x%x\r\n", pMem);
45       
46}
47
Note: See TracBrowser for help on using the repository browser.