title: qemu-system-i386: Could not allocate clusters for qcow2 header and refcount table: Bad address
body: <p>Can't start Android emulator on Mac 10.12.6. I noticed one output might be the cause:
  qemu-system-i386: Could not allocate clusters for qcow2 header and refcount table: Bad address</p>
  
  <p>Below is more output with -verbose and -debug all option:</p>
  
  <pre><code>emulator: Starting QT main loop
  
  emulator: Android qemu version 27.1.7.0 (build_id 4581633) (CL:b5ec07662db0f9d8644e5fbda7040053a8741bfd)
  
  emulator: Starting QEMU main loop
  emulator: android_qemud_init
  qemu-system-i386: Could not allocate clusters for qcow2 header and refcount table: Bad address
  emulator: Done with QEMU main loop
  emulator: found skin 'nexus_6' in directory: /Users/dzhang/Library/Android/sdk/skins/
  emulator: (metrics::NullMetricsWriter) created
  emulator: (metrics::NullMetricsReporter) created
  emulator: (metrics::reportConditional) ignoring
  emulator: skin_winsys_get_window_pos
  emulator: skin_winsys_get_window_pos: x=0 y=0
  emulator: Finished QT main loop
  </code></pre>
  
  <p>I googled around and didn't find anything relevant. Per code here: <a href="https://github.com/qemu/qemu/blob/master/block/qcow2.c" rel="nofollow noreferrer">https://github.com/qemu/qemu/blob/master/block/qcow2.c</a>
  Seems it failed to open image.</p>
  
  <p>Update: created a new image and got the same error message. The emulator crashed this time and below is the problem report:</p>
  
  <pre><code>Operating system: Mac OS X
                    10.12.6 16G1212
  CPU: amd64
       family 6 model 70 stepping 1
       8 CPUs
  
  Crash reason:  EXC_BAD_ACCESS / KERN_INVALID_ADDRESS
  Crash address: 0xd0
  Process uptime: 1 seconds
  
  Thread 10 (crashed)
   0  qemu-system-i386 + 0x354677
      rax = 0x00000000000000d0   rdx = 0x0000000000000000
      rcx = 0x00007fb1ea8007c0   rbx = 0x0000700001029000
      rsi = 0x0000000000000000   rdi = 0x000000010eeb8db0
      rbp = 0x0000700001028ef0   rsp = 0x0000700001028ed0
       r8 = 0x0000700000fa8000    r9 = 0x0000000000083000
      r10 = 0x0000000000000001   r11 = 0x0000000000000206
      r12 = 0x000000010d34a660   r13 = 0x0000000000009a17
      r14 = 0x00000000180008ff   r15 = 0x00007fb1ea8007c0
      rip = 0x000000010d34a677
      Found by: given as instruction pointer in context
  </code></pre>
  
  <p>Seems like a qemu issue?          </p>