[PATCH] D64794: [sanitizer_common] Don't initialize interceptor_metadata_map unless SI_POSIX is set

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 05:56:49 PDT 2019


evgeny777 created this revision.
evgeny777 added reviewers: kcc, eugenis.
Herald added a subscriber: kubamracek.

It looks like interceptor_metdata_map is not used if SI_POSIX is zero. I have non-posix platform and this change allows saving ~3MB of valuable memory.


https://reviews.llvm.org/D64794

Files:
  lib/sanitizer_common/sanitizer_common_interceptors.inc


Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -317,9 +317,11 @@
   };
 };
 
+#if SI_POSIX
 typedef AddrHashMap<CommonInterceptorMetadata, 31051> MetadataHashMap;
 
 static MetadataHashMap *interceptor_metadata_map;
+#endif
 
 #if SI_POSIX
 UNUSED static void SetInterceptorMetadata(__sanitizer_FILE *addr,
@@ -9547,9 +9549,11 @@
 #endif
 
 static void InitializeCommonInterceptors() {
+#if SI_POSIX
   static u64 metadata_mem[sizeof(MetadataHashMap) / sizeof(u64) + 1];
   interceptor_metadata_map =
       new ((void *)&metadata_mem) MetadataHashMap();  // NOLINT
+#endif
 
   INIT_MMAP;
   INIT_MMAP64;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64794.210075.patch
Type: text/x-patch
Size: 810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190716/b40cf5c2/attachment.bin>


More information about the llvm-commits mailing list