summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/lazy_instance.h7
-rw-r--r--tools/valgrind/memcheck/suppressions.txt10
2 files changed, 6 insertions, 11 deletions
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index c6785f3..1471335 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -41,6 +41,7 @@
#include "base/atomicops.h"
#include "base/base_export.h"
#include "base/basictypes.h"
+#include "base/logging.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/thread_restrictions.h"
@@ -51,6 +52,10 @@ struct DefaultLazyInstanceTraits {
static const bool kAllowedToAccessOnNonjoinableThread = false;
static Type* New(void* instance) {
+ DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) % sizeof(instance), 0u)
+ << ": Bad boy, the buffer passed to placement new is not aligned!\n"
+ "This may break some stuff like SSE-based optimizations assuming the "
+ "<Type> objects are word aligned.";
// Use placement new to initialize our instance in our preallocated space.
// The parenthesis is very important here to force POD type initialization.
return new (instance) Type();
@@ -186,8 +191,8 @@ class LazyInstance : public LazyInstanceHelper {
base::subtle::Release_Store(&me->state_, STATE_EMPTY);
}
- int8 buf_[sizeof(Type)]; // Preallocate the space for the Type instance.
Type *instance_;
+ int8 buf_[sizeof(Type)]; // Preallocate the space for the Type instance.
DISALLOW_COPY_AND_ASSIGN(LazyInstance);
};
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index dce9776..cd791d5 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -605,16 +605,6 @@
fun:CERT_ChangeCertTrust
}
{
- bug_64930 [vector-under-hashtable false positive leaks on x64]
- Memcheck:Leak
- ...
- fun:_ZNSt6vector*
- fun:_ZNSt6vector*
- fun:_ZN9__gnu_cxx9hashtable*
- fun:_ZN9__gnu_cxx9hashtable*
- fun:_ZN9__gnu_cxx8hash_map*
-}
-{
leaks in bash
Memcheck:Leak
...