Changeset 135 for trunk/nom/src
- Timestamp:
- Dec 3, 2006, 9:59:44 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nom/src/nomtkinit.c
r94 r135 51 51 #include "nomtst2.h" */ 52 52 #include <nomclassmanager.h> 53 /* Garbage collector */ 54 #include <gc.h> 53 55 54 56 /* Undef if you want debugging msg from somEnvironmentNew() */ … … 65 67 /* Toolkit functions, exported */ 66 68 /********************************************************/ 69 70 static gpointer gcMalloc(gulong ulBytes) 71 { 72 //printf("Hi there...\n"); 73 // return malloc(ulBytes); 74 return (gpointer) GC_malloc(ulBytes); 75 } 76 77 static gpointer gcRealloc(gpointer mem, gulong ulBytes) 78 { 79 // printf("...and here\n"); 80 // return realloc(mem, ulBytes); 81 return (gpointer) GC_realloc(mem, ulBytes); 82 } 83 84 static void gcFree(gpointer mem) 85 { 86 // printf("free(): %x\n", mem); 87 return; 88 GC_free(mem); 89 } 90 91 /* 92 This is called from the EMX wrapper to set the garbage collector 93 memory functions as the GLIB default allocation function. 94 */ 95 void _System nomInitGarbageCollection() 96 { 97 GMemVTable vtbl={0}; 98 99 /* Init the garbage collector */ 100 GC_init(); 101 102 vtbl.malloc=(gpointer)gcMalloc; 103 vtbl.realloc=(gpointer)gcRealloc; 104 vtbl.free=(gpointer)gcFree; 105 106 g_mem_set_vtable(&vtbl); 107 fprintf(stderr, " GC memory functions set for GLIB. (%s: %d)\n", __FILE__, __LINE__); 108 } 67 109 68 110 /*
Note:
See TracChangeset
for help on using the changeset viewer.