Changeset d89da7c6 in OpenModelica


Ignore:
Timestamp:
2016-04-05T12:35:18+02:00 (8 years ago)
Author:
Martin Sjölund <martin.sjolund@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
b500b84
Parents:
8287b0b
Message:

Keep track of more memory allocations

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Compiler/runtime/Error_omc.cpp

    r102e4da rd89da7c6  
    7272{
    7373  std::string res = ErrorImpl__printErrorsNoWarning(threadData);
    74   return GC_strdup(res.c_str());
     74  return omc_alloc_interface.malloc_strdup(res.c_str());
    7575}
    7676
     
    7878{
    7979  std::string res = ErrorImpl__printMessagesStr(threadData,warningsAsErrors);
    80   return GC_strdup(res.c_str());
     80  return omc_alloc_interface.malloc_strdup(res.c_str());
    8181}
    8282
  • Compiler/runtime/SimulationResultsCmp.c

    r70d6f0e2 rd89da7c6  
    8484  /* Copy the variable names from the MetaModelica list to the string array. */
    8585  for(; MMC_NILHDR != MMC_GETHDR(vars); vars = MMC_CDR(vars)) {
    86     cmpvars[i++] = GC_strdup(MMC_STRINGDATA(MMC_CAR(vars)));
     86    cmpvars[i++] = omc_alloc_interface.malloc_strdup(MMC_STRINGDATA(MMC_CAR(vars)));
    8787  }
    8888
  • Compiler/runtime/SimulationResultsCmpTubes.c

    r70d6f0e2 rd89da7c6  
    801801    fclose(fout);
    802802    if (isHtml) {
    803       *htmlOut = GC_strdup(html);
     803      *htmlOut = omc_alloc_interface.malloc_strdup(html);
    804804      free(html);
    805805    }
  • Compiler/runtime/System_omc.c

    r5e18b052 rd89da7c6  
    205205extern const char* System_dirname(const char* str)
    206206{
    207   char *cpy = GC_strdup(str);
     207  char *cpy = omc_alloc_interface.malloc_strdup(str);
    208208  char *res = NULL;
    209209#if defined(_MSC_VER)
     
    319319  char *s;
    320320  void *res = mmc_mk_nil();
    321   char *str = GC_strdup(str0);
     321  char *str = omc_alloc_interface.malloc_strdup(str0);
    322322  char *saveptr;
    323323  s=strtok_r(str,delimit,&saveptr);
     
    396396void System_setClassnamesForSimulation(const char *class_names)
    397397{
    398   class_names_for_simulation = GC_strdup(class_names);
     398  class_names_for_simulation = omc_alloc_interface.malloc_strdup(class_names);
    399399}
    400400
     
    728728    MMC_THROW();
    729729  }
    730   return GC_strdup(buf);
     730  return omc_alloc_interface.malloc_strdup(buf);
    731731}
    732732
  • Compiler/runtime/settingsimpl.c

    r3fe15e26 rd89da7c6  
    119119    exit(EXIT_FAILURE);
    120120  } else {
    121     omhome = GC_strdup(info.dli_fname);
     121    omhome = omc_alloc_interface.malloc_strdup(info.dli_fname);
    122122    stripbinpath(omhome);
    123123  }
     
    215215    return "";
    216216  }
    217   return GC_strdup(homePath);
     217  return omc_alloc_interface.malloc_strdup(homePath);
    218218}
    219219
     
    238238    } else {
    239239      int lenHome = strlen(homePath);
    240       buffer = (char*) GC_malloc_atomic(lenOmhome+lenHome+41);
     240      buffer = (char*) omc_alloc_interface.malloc_atomic(lenOmhome+lenHome+41);
    241241      snprintf(buffer,lenOmhome+lenHome+41,"%s/lib/omlibrary:%s/.openmodelica/libraries/",omhome,homePath);
    242242    }
     
    248248  /* adrpo: translate this to forward slashes! */
    249249  /* duplicate the path */
    250   winLibPath = GC_strdup(path);
     250  winLibPath = omc_alloc_interface.malloc_strdup(path);
    251251
    252252  /* ?? not enough memory for duplication */
    253253  if (!winLibPath)
    254     return GC_strdup(path);
     254    return omc_alloc_interface.malloc_strdup(path);
    255255
    256256  /* convert \\ to / */
     
    263263#endif
    264264
    265   return GC_strdup(path);
     265  return omc_alloc_interface.malloc_strdup(path);
    266266}
    267267
  • Compiler/runtime/systemimpl.c

    r5e18b052 rd89da7c6  
    234234extern int SystemImpl__setCCompiler(const char *str)
    235235{
    236   cc = GC_strdup(str);
     236  cc = omc_alloc_interface.malloc_strdup(str);
    237237  if (cc == NULL) return -1;
    238238  return 0;
     
    241241extern int SystemImpl__setCXXCompiler(const char *str)
    242242{
    243   cxx = GC_strdup(str);
     243  cxx = omc_alloc_interface.malloc_strdup(str);
    244244  if (cxx == NULL) return -1;
    245245  return 0;
     
    248248extern int SystemImpl__setLinker(const char *str)
    249249{
    250   linker = GC_strdup(str);
     250  linker = omc_alloc_interface.malloc_strdup(str);
    251251  if (linker == NULL) return -1;
    252252  return 0;
     
    255255extern int SystemImpl__setCFlags(const char *str)
    256256{
    257   cflags = GC_strdup(str);
     257  cflags = omc_alloc_interface.malloc_strdup(str);
    258258  if (cflags == NULL) return -1;
    259259  return 0;
     
    262262extern int SystemImpl__setLDFlags(const char *str)
    263263{
    264   ldflags = GC_strdup(str);
     264  ldflags = omc_alloc_interface.malloc_strdup(str);
    265265  if (ldflags == NULL) return -1;
    266266  return 0;
     
    282282    if (buf[i] == '\\') buf[i] = '/';
    283283  }
    284   return GC_strdup(buf);
     284  return omc_alloc_interface.malloc_strdup(buf);
    285285#else
    286286  if (NULL == getcwd(buf,MAXPATHLEN)) {
     
    288288    return NULL;
    289289  }
    290   return GC_strdup(buf);
     290  return omc_alloc_interface.malloc_strdup(buf);
    291291#endif
    292292}
     
    684684  }
    685685
    686   char *res = GC_strdup(-1 == pclose(pipe) ? strerror(errno) : Print_getString(threadData));
     686  char *res = omc_alloc_interface.malloc_strdup(-1 == pclose(pipe) ? strerror(errno) : Print_getString(threadData));
    687687  Print_restoreBuf(threadData, handle);
    688688
     
    995995      {
    996996        /* basepath is finally found */
    997         pattern = GC_strdup(str);
     997        pattern = omc_alloc_interface.malloc_strdup(str);
    998998        break;
    999999      }
     
    10091009        {
    10101010          /* basepath is finally found */
    1011           pattern = GC_strdup(str);
     1011          pattern = omc_alloc_interface.malloc_strdup(str);
    10121012          sub = res;
    10131013          len_sub = strlen(sub);
     
    18641864  } while (cont && ++i < MODELICAPATH_LEVELS);
    18651865  if (*buf == ' ') buf++;
    1866   *versionExtra = GC_strdup(buf);
     1866  *versionExtra = omc_alloc_interface.malloc_strdup(buf);
    18671867  len = strlen(*versionExtra);
    18681868  /* fprintf(stderr, "have len %ld versionExtra %s\n", len, *versionExtra); */
     
    19481948          continue;
    19491949        res[i].dir = mp;
    1950         res[i].file = GC_strdup(ent->d_name);
     1950        res[i].file = omc_alloc_interface.malloc_strdup(ent->d_name);
    19511951        if (res[i].file[nlen] == ' ') {
    19521952          splitVersion(res[i].file+nlen+1, res[i].version, &res[i].versionExtra);
     
    23492349  if (!old_ctype_default)
    23502350    old_ctype_default = "UTF-8";
    2351   char *old_ctype = GC_strdup(old_ctype_default);
     2351  char *old_ctype = omc_alloc_interface.malloc_strdup(old_ctype_default);
    23522352  int old_ctype_is_utf8 = strcmp(nl_langinfo(CODESET), "UTF-8") == 0;
    23532353
     
    28002800  char buf[64] = {0}; /* needs to be >=26 char */
    28012801  time_t t = (time_t) time;
    2802   return GC_strdup(ctime_r(&t,buf));
     2802  return omc_alloc_interface.malloc_strdup(ctime_r(&t,buf));
    28032803}
    28042804
     
    30013001    *name = "";
    30023002  } else {
    3003     *file = GC_strdup(info.dli_fname);
    3004     *name = GC_strdup(info.dli_sname);
     3003    *file = omc_alloc_interface.malloc_strdup(info.dli_fname);
     3004    *name = omc_alloc_interface.malloc_strdup(info.dli_sname);
    30053005  }
    30063006#endif
  • SimulationRuntime/c/meta/gc/mmc_gc.h

    r9b7aa44d rd89da7c6  
    113113/* for arrays only */
    114114static inline void* mmc_alloc_words_atomic_ignore_off_page(unsigned int nwords) {
     115#if defined(OMC_RECORD_ALLOC_WORDS)
     116  mmc_record_alloc_words((nwords) * sizeof(void*));
     117#endif
    115118  return GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE((nwords) * sizeof(void*));
    116119}
     
    118121/* for arrays only */
    119122static inline void* mmc_alloc_words_ignore_off_page(unsigned int nwords) {
     123#if defined(OMC_RECORD_ALLOC_WORDS)
     124  mmc_record_alloc_words((nwords) * sizeof(void*));
     125#endif
    120126  return GC_MALLOC_IGNORE_OFF_PAGE((nwords) * sizeof(void*));
    121127}
Note: See TracChangeset for help on using the changeset viewer.