Changeset 30772 for branches/eam_branches/ipp-20110213/psLib
- Timestamp:
- Mar 1, 2011, 6:21:28 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psLib/src
- Files:
-
- 3 edited
-
sys/psMemory.c (modified) (2 diffs)
-
sys/psMemory.h (modified) (1 diff)
-
types/psArguments.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.c
r30595 r30772 27 27 #include <string.h> 28 28 #include <assert.h> 29 #include <unistd.h> 29 30 30 31 #if defined(PS_MEM_BACKTRACE) && defined(HAVE_BACKTRACE) … … 1090 1091 return (memBlock1->freeFunc == memBlock2->freeFunc); 1091 1092 } 1093 1094 bool static dumpMemory = false; 1095 1096 void psMemDumpSetState (bool state) { 1097 dumpMemory = state; 1098 } 1099 1100 void psMemDump(const char *name) 1101 { 1102 if (!dumpMemory) return; 1103 1104 char filename[1024]; // don't make your sub-names too long! 1105 static int num = 0; // Counter, to make files unique and give an idea of sequence 1106 1107 snprintf (filename, 1024, "memdump_%s_%03d.txt", name, num); 1108 FILE *memFile = fopen(filename, "w"); 1109 1110 psMemBlock **leaks = NULL; 1111 int numLeaks = psMemCheckLeaks(0, &leaks, NULL, true); 1112 fprintf(memFile, "# MemBlock Size Source\n"); 1113 unsigned long total = 0; // Total memory used 1114 for (int i = 0; i < numLeaks; i++) { 1115 psMemBlock *mb = leaks[i]; 1116 fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, mb->file, mb->lineno); 1117 total += mb->userMemorySize; 1118 } 1119 fclose(memFile); 1120 psFree(leaks); 1121 1122 fprintf(stderr, "Memdump %s %d: Memory use: %ld, sbrk: %p\n", name, num, total, (void *) sbrk(0)); 1123 num++; 1124 } -
branches/eam_branches/ipp-20110213/psLib/src/sys/psMemory.h
r26892 r30772 647 647 ); 648 648 649 void psMemDumpSetState (bool state); 650 void psMemDump(const char *name); 651 649 652 // Ensure this is a psLib pointer 650 653 #define PS_ASSERT_PTR_HEAVY(PTR, RVAL) \ -
branches/eam_branches/ipp-20110213/psLib/src/types/psArguments.h
r24143 r30772 81 81 * specific routine called pkgnameVersionLong() is presumed to exist. 82 82 */ 83 #define PS ARGUMENTS_INSTANTIATE_GENERICS( pkgname, config, argc, argv ) \83 #define PS_ARGUMENTS_GENERIC( pkgname, config, argc, argv ) \ 84 84 { int N= psArgumentGet (argc, argv, "-version"); \ 85 85 if (N) { \ … … 115 115 * presumed to exist. 116 116 */ 117 #define PS ARGUMENTS_INSTANTIATE_THREADSARG( pkgname, config, argc, argv ) \117 #define PS_ARGUMENTS_THREADS( pkgname, config, argc, argv ) \ 118 118 { int N= psArgumentGet(argc, argv, "-threads"); \ 119 119 if (N) { \
Note:
See TracChangeset
for help on using the changeset viewer.
