void chpl_setMemFlags(void) { chpl_bool local_memTrack = false; // // Get the values of the memTracking config consts from the module. // The runtime also has the execution-time settings for these same // config consts, but if their default values are changed at compile // time only the emitted code for the module reflects that; the // runtime doesn't know about it. So, we need to get the values // from the module. // // We use local_memTrack here so that the module code doesn't store // directly to our flag and effectively turn on memory tracking too // early. In the first version of this code I passed &chpl_memTrack // itself, and for comm=gasnet we ended up tracking an extra 2 bytes // of space the comm layer allocated as a result of our own call to // chpl_memTracking_returnConfigVals(). // chpl_memTracking_returnConfigVals(&local_memTrack, &memStats, &memLeaks, &memLeaksTable, &memMax, &memThreshold, &memLog, &memLeaksLog); if (local_memTrack || memStats || memLeaks || memLeaksTable || memMax > 0 || strcmp(memLeaksLog, "") != 0) { chpl_memTrack = true; } if (strcmp(memLog, "") == 0) { memLogFile = stdout; } else { if (chpl_numNodes == 1) { memLogFile = fopen(memLog, "w"); } else { char* filename = (char*)malloc((strlen(memLog)+10)*sizeof(char)); sprintf(filename, "%s.%" FORMAT_c_nodeid_t, memLog, chpl_nodeID); memLogFile = fopen(filename, "w"); free(filename); } } if (chpl_memTrack) { chpl_sync_initAux(&memTrack_sync); hashSizeIndex = 0; hashSize = hashSizes[hashSizeIndex]; memTable = calloc(hashSize, sizeof(memTableEntry*)); } }
void chpl_privatization_init(void) { chpl_sync_initAux(&privatizationSync); }