Bug 938730 - avoid mix of memory allocators (crashes) when using system sqlite, r=asuth
authorKai Engert <kaie@kuix.de>
Wed, 20 Nov 2013 20:25:12 +0100
changeset 156650 247ff2131af52ef03f02e1725c0ee4139e577076
parent 156649 befb8bacc65eba6b4a5785869b38b6c934e8d35e
child 156651 038a45f0c9d583c4608bd3c5a3f46cce4d92ecaf
push idunknown
push userunknown
push dateunknown
reviewersasuth
bugs938730
milestone28.0a1
Bug 938730 - avoid mix of memory allocators (crashes) when using system sqlite, r=asuth
storage/src/Makefile.in
--- a/storage/src/Makefile.in
+++ b/storage/src/Makefile.in
@@ -1,24 +1,31 @@
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Don't use the jemalloc allocator on Android, because we can't guarantee
 # that Gecko will configure sqlite before it is first used (bug 730495).
 #
+# Don't use the jemalloc allocator when using system sqlite. Linked in libraries
+# (such as NSS) might trigger an initialization of sqlite and allocation
+# of memory using the default allocator, prior to the storage service
+# registering its allocator, causing memory management failures (bug 938730).
+#
 # Note: On Windows our sqlite build assumes we use jemalloc.  If you disable
 # MOZ_STORAGE_MEMORY on Windows, you will also need to change the "ifdef
 # MOZ_MEMORY" options in db/sqlite3/src/Makefile.in.
 ifdef MOZ_MEMORY
+ifndef MOZ_NATIVE_SQLITE
 ifneq ($(OS_TARGET), Android)
 DEFINES += -DMOZ_STORAGE_MEMORY
 endif
 endif
+endif
 
 # For nsDependentJSString
 LOCAL_INCLUDES = \
   $(SQLITE_CFLAGS) \
   -I$(topsrcdir)/db/sqlite3/src \
   -I$(topsrcdir)/dom/base \
   $(NULL)