       ManagedBuffer<Header, Element>) throws -> Header
   ) rethrows -> ManagedBuffer<Header, Element> {
 
-    let p = try ManagedBufferPointer<Header, Element>(
-      bufferClass: self,
-      minimumCapacity: minimumCapacity,
-      makingHeaderWith: { buffer, _ in
-        try factory(
-          unsafeDowncast(buffer, to: ManagedBuffer<Header, Element>.self))
-      })
-
-    return unsafeDowncast(p.buffer, to: ManagedBuffer<Header, Element>.self)
-  }
-
-  /// Destroy the stored Header.
-  deinit {
-    ManagedBufferPointer(self).withUnsafeMutablePointerToHeader {
-      _ = $0.deinitialize()
-    }
+    let p = Builtin.allocWithTailElems_1(
+         self,
+         minimumCapacity._builtinWordValue, Element.self)
+
+    let initHeaderVal = try factory(p)
+    p.headerAddress.initialize(to: initHeaderVal)
+    // The _fixLifetime is not really needed, because p is used afterwards.
+    // But let's be conservative and fix the lifetime after we use the
+    // headerAddress.
+    _fixLifetime(p) 
+    return p
   }
 
   /// The actual number of elements that can be stored in this object.

  public final func withUnsafeMutablePointers<R>(
    _ body: (UnsafeMutablePointer<Header>, UnsafeMutablePointer<Element>) throws -> R
  ) rethrows -> R {
    return try ManagedBufferPointer(self).withUnsafeMutablePointers(body)
  }

  /// The stored `Header` instance.

    _sanityCheck(
      _class_getInstancePositiveExtentSize(bufferClass) == MemoryLayout<_HeapObject>.size
      || (
        (!creating || bufferClass is ManagedBuffer<Header, Element>.Type)
        && _class_getInstancePositiveExtentSize(bufferClass)
          == _headerOffset + MemoryLayout<Header>.size),
      "ManagedBufferPointer buffer class has illegal stored properties"
