Changeset 536387b in OpenModelica


Ignore:
Timestamp:
2016-04-04T14:37:05+02:00 (8 years ago)
Author:
hudson <openmodelica@…>
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, master, omlib-staging
Children:
68465ab6
Parents:
4f671af
git-author:
Martin Sjölund <martin.sjolund@…> (04/04/16 14:37:05)
git-committer:
hudson <openmodelica@…> (04/04/16 14:37:05)
Message:

Profile memory allocations for strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SimulationRuntime/c/util/memory_pool.c

    r2ed993a r536387b  
    143143};
    144144
     145#if defined(OMC_RECORD_ALLOC_WORDS)
     146#include "meta/gc/mmc_gc.h"
     147
     148static void* OMC_record_malloc(size_t sz)
     149{
     150  mmc_record_alloc_words(sz);
     151  return GC_malloc(sz);
     152}
     153
     154static void* OMC_record_malloc_uncollectable(size_t sz)
     155{
     156  mmc_record_alloc_words(sz);
     157  return GC_malloc_uncollectable(sz);
     158}
     159
     160static void* OMC_record_malloc_atomic(size_t sz)
     161{
     162  mmc_record_alloc_words(sz);
     163  return GC_malloc_atomic(sz);
     164}
     165
     166static void* OMC_record_strdup(const char *str)
     167{
     168  mmc_record_alloc_words(strlen(str)+1);
     169  return GC_strdup(sz);
     170}
     171
     172#endif
     173
    145174omc_alloc_interface_t omc_alloc_interface = {
    146175#if !defined(OMC_MINIMAL_RUNTIME)
     176#if !defined(OMC_RECORD_ALLOC_WORDS)
    147177  GC_init,
    148178  GC_malloc,
     
    156186  nofree
    157187#else
     188  GC_init,
     189  OMC_record_malloc,
     190  OMC_record_malloc_atomic,
     191  (char*(*)(size_t)) OMC_record_malloc_atomic,
     192  OMC_record_strdup,
     193  GC_collect_a_little_or_not,
     194  OMC_record_malloc_uncollectable,
     195  GC_free,
     196  OMC_record_malloc_atomic,
     197  nofree
     198#endif
     199#else
    158200  pool_init,
    159201  pool_malloc,
Note: See TracChangeset for help on using the changeset viewer.