The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
platform.c
Go to the documentation of this file.
1 
30 #include <stddef.h>
31 #include <stdlib.h>
32 
33 #include <mm/dymelor.h>
34 #include <core/core.h>
35 
36 extern void *__real_malloc(size_t);
37 extern void __real_free(void *);
38 extern void *__real_realloc(void *, size_t);
39 extern void *__real_calloc(size_t, size_t);
40 
41 inline void *rsalloc(size_t size)
42 {
43  void *mem_block = __real_malloc(size);
44  if (unlikely(mem_block == NULL)) {
45  rootsim_error(true, "Error in memory allocation, aborting...");
46  }
47  return mem_block;
48 }
49 
50 inline void rsfree(void *ptr)
51 {
52  __real_free(ptr);
53 }
54 
55 inline void *rsrealloc(void *ptr, size_t size)
56 {
57  return __real_realloc(ptr, size);
58 }
59 
60 inline void *rscalloc(size_t nmemb, size_t size)
61 {
62  return __real_calloc(nmemb, size);
63 }
Core ROOT-Sim functionalities.
Dynamic Memory Logger and Restorer (DyMeLoR)
#define unlikely(exp)
Optimize the branch as likely not taken.
Definition: core.h:74