示例#1
0
void chpl_track_realloc_pre(void* memAlloc, size_t size,
                         chpl_mem_descInt_t description,
                         int32_t lineno, int32_t filename) {
  memTableEntry* memEntry = NULL;

  if (chpl_memTrack && size > memThreshold) {
    memTrack_lock();
    if (memAlloc) {
      memEntry = removeMemTableEntry(memAlloc);
      if (memEntry)
        sys_free(memEntry);
    }
    memTrack_unlock();
  }
}
示例#2
0
void chpl_track_realloc_pre(void* memAlloc, size_t size,
                         chpl_mem_descInt_t description,
                         int32_t lineno, c_string filename) {
  memTableEntry* memEntry = NULL;

  if (chpl_memTrack && size > memThreshold) {
    chpl_sync_lock(&memTrack_sync);
    if (memAlloc) {
      memEntry = removeMemTableEntry(memAlloc);
      if (memEntry)
        free(memEntry);
    }
    chpl_sync_unlock(&memTrack_sync);
  }
}
示例#3
0
void chpl_track_free(void* memAlloc, int32_t lineno, int32_t filename) {
  memTableEntry* memEntry = NULL;
  if (chpl_memTrack) {
    memTrack_lock();
    memEntry = removeMemTableEntry(memAlloc);
    if (memEntry) {
      if (chpl_verbose_mem) {
        fprintf(memLogFile, "%" PRI_c_nodeid_t ": %s:%" PRId32
                            ": free %zuB of %s at %p\n",
                chpl_nodeID, (filename ? chpl_lookupFilename(filename) : "--"),
                lineno, memEntry->number * memEntry->size,
                chpl_mem_descString(memEntry->description), memAlloc);
      }
      sys_free(memEntry);
    }
    memTrack_unlock();
  } else if (chpl_verbose_mem && !memEntry) {
    fprintf(memLogFile, "%" PRI_c_nodeid_t ": %s:%" PRId32 ": free at %p\n",
            chpl_nodeID, (filename ? chpl_lookupFilename(filename) : "--"),
            lineno, memAlloc);
  }
}
示例#4
0
void chpl_track_free(void* memAlloc, int32_t lineno, c_string filename) {
  memTableEntry* memEntry = NULL;
  if (chpl_memTrack) {
    chpl_sync_lock(&memTrack_sync);
    memEntry = removeMemTableEntry(memAlloc);
    if (memEntry) {
      if (chpl_verbose_mem) {
        fprintf(memLogFile,
                "%" FORMAT_c_nodeid_t ": %s:%" PRId32
                ": free %zuB of %s at %p\n",
                chpl_nodeID, (filename ? filename : "--"), lineno,
                memEntry->number*memEntry->size,
                chpl_mem_descString(memEntry->description), memAlloc);
      }
      free(memEntry);
    }
    chpl_sync_unlock(&memTrack_sync);
  } else if (chpl_verbose_mem && !memEntry) {
    fprintf(memLogFile,
            "%" FORMAT_c_nodeid_t ": %s:%" PRId32 ": free at %p\n",
            chpl_nodeID, (filename ? filename : "--"), lineno, memAlloc);
  }
}