Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Die loudly if smpi_shared_realloc_intercept is used.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 8 Jun 2021 13:53:02 +0000 (15:53 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 8 Jun 2021 14:03:09 +0000 (16:03 +0200)
include/smpi/sampi.h
include/smpi/smpi_helpers.h
include/smpi/smpi_helpers_internal.h
src/smpi/internals/smpi_shared.cpp

index dc5095e..dd94dee 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef HAVE_SMPI
 #undef malloc
 #undef calloc
+#undef realloc
 #undef free
 // Internally disable these overrides (HAVE_SMPI is only defined when building the library)
 #define malloc(nbytes) _sampi_malloc(nbytes)
index 68df20f..ef7492d 100644 (file)
@@ -35,6 +35,7 @@
 #ifndef SMPI_NO_OVERRIDE_MALLOC
 #define malloc(x) smpi_shared_malloc_intercept((x), __FILE__, __LINE__)
 #define calloc(x, y) smpi_shared_calloc_intercept((x), (y), __FILE__, __LINE__)
+#define realloc(x, y) smpi_shared_realloc_intercept((x), (y), __FILE__, __LINE__)
 #define free(x) smpi_shared_free(x)
 #endif
 #endif
index 404d1cb..25a4f70 100644 (file)
@@ -36,6 +36,7 @@ int smpi_getopt(int argc, char* const* argv, const char* options);
 
 void* smpi_shared_malloc_intercept(size_t size, const char* file, int line);
 void* smpi_shared_calloc_intercept(size_t num_elm, size_t elem_size, const char* file, int line);
+void* smpi_shared_realloc_intercept(void* data, size_t size, const char* file, int line);
 void smpi_shared_free(void* data);
 #ifdef __cplusplus
 } // extern "C"
index dfc99b8..7ba2950 100644 (file)
@@ -333,6 +333,13 @@ void* smpi_shared_calloc_intercept(size_t num_elm, size_t elem_size, const char*
   }
 }
 
+void* smpi_shared_realloc_intercept(void* /*data*/, size_t /*size*/, const char* file, int line)
+{
+  // FIXME
+  XBT_ERROR("%s:%d: using realloc() with SMPI malloc interception is currently not supported", file, line);
+  xbt_die("Please recompile with -DSMPI_NO_OVERRIDE_MALLOC");
+}
+
 void* smpi_shared_malloc(size_t size, const char* file, int line)
 {
   if (size > 0 && smpi_cfg_shared_malloc() == SharedMallocType::LOCAL) {