title: Swift JavaScriptCore crash sometimes (bmalloc::VMHeap::grow())
body: <p>I use javaScriptCore in my swift project, there has two images on the webview, I want click the image to present my swift viewController, in html, the function of click image named "scanImgs", this is my code </p>
  
  <pre><code>func webViewDidFinishLoad(webView: UIWebView) {
  
      guard let context = webView.valueForKeyPath("documentView.webView.mainFrame.javaScriptContext") as? JSContext else {
          return
      }
  
      let scanImgs: @convention(block) (String, String, Int) -&gt; Void = { (image1: String, image2: String, index: Int) in
  
          let photosVC: UIViewController = SpursPhotoBrowserViewController.getPhotoBrowser(image1, secondImageURL: image2, selectIndex: UInt(index))
  
          dispatch_async(dispatch_get_main_queue(), { 
              self.presentViewController(photosVC, animated: true, completion: nil)
          })
      }
  
      context.setObject(unsafeBitCast(scanImgs, AnyObject.self), forKeyedSubscript: "scanImgs")
  
  }
  </code></pre>
  
  <p>this code can running right most of time, but sometimes i get crash in JavaScriptCore, this is crash log    </p>
  
  <pre><code> 0 JavaScriptCore   bmalloc::VMHeap::grow() + 132
   1 JavaScriptCore   bmalloc::VMHeap::grow() + 56
   2 JavaScriptCore   bmalloc::Heap::allocateSmallPage(std::__1::lock_guard&lt;bmalloc::StaticMutex&gt;&amp;, unsigned long) + 244
   3 JavaScriptCore   bmalloc::Heap::refillSmallBumpRangeCache(std::__1::lock_guard&lt;bmalloc::StaticMutex&gt;&amp;, unsigned long, bmalloc::FixedVector&lt;bmalloc::BumpRange, 32ul&gt;&amp;) + 36
   4 JavaScriptCore   bmalloc::Allocator::allocateBumpRangeSlowCase(unsigned long) + 128
   5 JavaScriptCore   bmalloc::Allocator::allocateSlowCase(unsigned long) + 180
   6 WebCore  cssyyparse(WebCore::CSSParser*) + 1232
   7 WebCore  WebCore::CSSParser::parseSheet(WebCore::StyleSheetContents*, WTF::String const&amp;, WTF::TextPosition const&amp;, WTF::Vector&lt;WTF::RefPtr&lt;WebCore::CSSRuleSourceData&gt;, 0ul, WTF::CrashOnOverflow, 16ul&gt;*, bool) + 488
   8 WebCore  WebCore::StyleSheetContents::parseAuthorStyleSheet(WebCore::CachedCSSStyleSheet const*, WebCore::SecurityOrigin const*) + 164
   9 WebCore  WebCore::HTMLLinkElement::setCSSStyleSheet(WTF::String const&amp;, WebCore::URL const&amp;, WTF::String const&amp;, WebCore::CachedCSSStyleSheet const*) + 996
   10 WebCore WebCore::CachedCSSStyleSheet::didAddClient(WebCore::CachedResourceClient*) + 116
   11 WebCore WebCore::HTMLLinkElement::process() + 2064
   12 WebCore WebCore::HTMLLinkElement::insertedInto(WebCore::ContainerNode&amp;) + 80
   13 WebCore WebCore::ChildNodeInsertionNotifier::notify(WebCore::Node&amp;, WTF::Vector&lt;WTF::Ref&lt;WebCore::Node&gt;, 11ul, WTF::CrashOnOverflow, 16ul&gt;&amp;) + 164
   14 WebCore WebCore::ContainerNode::notifyChildInserted(WebCore::Node&amp;, WebCore::ContainerNode::ChildChangeSource) + 172
   15 WebCore WebCore::ContainerNode::parserAppendChild(WTF::PassRefPtr&lt;WebCore::Node&gt;) + 240
   16 WebCore WebCore::insert(WebCore::HTMLConstructionSiteTask&amp;) + 228
   17 WebCore WebCore::HTMLConstructionSite::executeQueuedTasks() + 148
   18 WebCore WebCore::HTMLDocumentParser::constructTreeFromHTMLToken(WebCore::HTMLTokenizer::TokenPtr&amp;) + 156
   19 WebCore WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode) + 352
   20 WebCore WebCore::HTMLDocumentParser::append(WTF::PassRefPtr&lt;WTF::StringImpl&gt;) + 608
   21 WebCore WebCore::DecodedDataDocumentParser::appendBytes(WebCore::DocumentWriter&amp;, char const*, unsigned long) + 116
   22 WebCore WebCore::DocumentLoader::commitData(char const*, unsigned long) + 596
   23 WebKitLegacy    -[WebHTMLRepresentation receivedData:withDataSource:] + 112
   24 WebKitLegacy    -[WebDataSource(WebInternal) _receivedData:] + 68
   25 WebKitLegacy    WebFrameLoaderClient::committedLoad(WebCore::DocumentLoader*, char const*, int) + 112
   26 WebCore WebCore::DocumentLoader::commitLoad(char const*, int) + 172
   27 WebCore WebCore::CachedRawResource::didAddClient(WebCore::CachedResourceClient*) + 828
   28 WebCore WebCore::ThreadTimers::sharedTimerFiredInternal() + 148
   29 WebCore WebCore::timerFired(__CFRunLoopTimer*, void*) + 36
   30 CoreFoundation  ___CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
   31 CoreFoundation  ___CFRunLoopDoTimer + 884
   32 CoreFoundation  ___CFRunLoopRun + 1520
   33 CoreFoundation  CFRunLoopRunSpecific + 384
   34 WebCore RunWebThread(void*) + 456
   35 libsystem_pthread.dylib __pthread_body + 156
   36 libsystem_pthread.dylib __pthread_body
  </code></pre>
  
  <p>what's wrong with this bug...</p>