Use bionic's dlmalloc 2.8.5.

Also fix free space computations for DDMS.

Change-Id: Icbc045b5461af89a0516f37f01acaaa815205348
diff --git a/src/jdwp/jdwp_event.cc b/src/jdwp/jdwp_event.cc
index 0e7bb99..0eb2930 100644
--- a/src/jdwp/jdwp_event.cc
+++ b/src/jdwp/jdwp_event.cc
@@ -1070,13 +1070,25 @@
   wrapiov[0].iov_base = header;
   wrapiov[0].iov_len = sizeof(header);
 
-  /*
-   * Make sure we're in VMWAIT in case the write blocks.
-   */
+  // Try to avoid blocking GC during a send, but only safe when not using mutexes at a lower-level
+  // than mutator for lock ordering reasons.
   Thread* self = Thread::Current();
-  self->TransitionFromRunnableToSuspended(kWaitingForDebuggerSend);
-  (*transport_->sendBufferedRequest)(this, wrapiov, iov_count + 1);
-  self->TransitionFromSuspendedToRunnable();
+  bool safe_to_release_mutator_lock_over_send;
+  for (size_t i=0; i < kMutatorLock; ++i) {
+    if (self->GetHeldMutex(static_cast<MutexLevel>(i)) != NULL) {
+      safe_to_release_mutator_lock_over_send = false;
+      break;
+    }
+  }
+  if (safe_to_release_mutator_lock_over_send) {
+    // Change state to waiting to allow GC, ... while we're sending.
+    self->TransitionFromRunnableToSuspended(kWaitingForDebuggerSend);
+    (*transport_->sendBufferedRequest)(this, wrapiov, iov_count + 1);
+    self->TransitionFromSuspendedToRunnable();
+  } else {
+    // Send and possibly block GC...
+    (*transport_->sendBufferedRequest)(this, wrapiov, iov_count + 1);
+  }
 }
 
 }  // namespace JDWP
diff --git a/src/jdwp/jdwp_main.cc b/src/jdwp/jdwp_main.cc
index beec7af..4b442db 100644
--- a/src/jdwp/jdwp_main.cc
+++ b/src/jdwp/jdwp_main.cc
@@ -99,7 +99,7 @@
       attach_lock_("JDWP attach lock"),
       attach_cond_("JDWP attach condition variable"),
       last_activity_time_ms_(0),
-      serial_lock_("JDWP serial lock"),
+      serial_lock_("JDWP serial lock", kJdwpSerialLock),
       request_serial_(0x10000000),
       event_serial_(0x20000000),
       event_list_lock_("JDWP event list lock"),