Changeset 540
- Timestamp:
- Apr 27, 2004, 4:50:56 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/sysUtils/tst_psMemory.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sysUtils/tst_psMemory.c
r537 r540 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-04-28 02: 29:13$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-04-28 02:50:56 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #include "psTest.h" 20 20 #include "psMemory.h" 21 #include "psAbort.h" 21 22 22 int TPFreeReferencedMemory(void); 23 static int TPFreeReferencedMemory(void); 24 static int TPCheckBufferPositive(void); 23 25 24 26 testDescription tests[] = { 27 {TPCheckBufferPositive,"TPCheckBufferPositive",0}, 25 28 {TPFreeReferencedMemory,"TPFreeReferencedMemory",6}, 26 29 {NULL} … … 32 35 } 33 36 37 int TPCheckBufferPositive(void) 38 { 39 int* mem; 40 const int size = 100; 41 int failed = 0; 42 43 printf("Allocating buffer\n"); 44 mem = (int*) psAlloc(size*sizeof(int)); 45 46 for (int index=0;index<size;index++) { 47 mem[index]=index; 48 } 49 50 for (int index=0;index<size;index++) { 51 if (mem[index] != index) { 52 failed++; 53 } 54 } 55 56 return failed; 57 } 58 34 59 int TPFreeReferencedMemory(void) 35 60 { … … 37 62 int* mem; 38 63 39 printf("Allocating buffer \n");64 printf("Allocating buffer.\n"); 40 65 mem = (int*) psAlloc(100*sizeof(int)); 41 66 42 67 psMemIncrRefCounter(mem); 43 printf("Freeing first time\n");68 printf("Freeing buffer after incrementing reference count.\n"); 44 69 psFree(mem); 45 46 printf("I survived?\n");47 70 48 71 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.
