[M67 Dev][Tizen] Redirect UncheckedMalloc to malloc for Tizen 25/185925/2
authorChandan Padhi <c.padhi@samsung.com>
Fri, 3 Aug 2018 12:48:23 +0000 (18:18 +0530)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 6 Aug 2018 06:31:52 +0000 (06:31 +0000)
On Tizen, BufferManager::DoBufferData tries to call free() to
deallocate a memory that was allocated by tc_malloc in
UncheckedMalloc(), which caused crash for most web pages.
To fix it, we redirect UncheckedMalloc to malloc for Tizen.

Seems like we do not use tcmalloc for chromium-efl in a consistent
manner. We should either fix it or disable tcmalloc.

Reference:
http://165.213.202.130/gerrit/#/c/71875/
http://165.213.202.130/gerrit/#/c/72475/

Change-Id: Iacc6776736c193d6fa66707ff28048d42267ac12
Signed-off-by: Chandan Padhi <c.padhi@samsung.com>
base/process/memory_linux.cc

index 21b2069..ca9cd26 100644 (file)
@@ -100,8 +100,10 @@ bool AdjustOOMScore(ProcessId process, int score) {
 bool UncheckedMalloc(size_t size, void** result) {
 #if BUILDFLAG(USE_ALLOCATOR_SHIM)
   *result = allocator::UncheckedAlloc(size);
+// FIXME: Since we do not use tcmalloc for chromium-efl in a consistent
+// manner, we should either fix it or disable tcmalloc.
 #elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || \
-    (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC))
+    (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC) || defined(USE_EFL))
   *result = malloc(size);
 #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
   *result = __libc_malloc(size);