anchor.diff:              let fvc = g.faceVertexCount
               let vertexCount = g.vertexCount
               
  -            let vertexPtr = vertexManager.Alloc vertexCount
  +            let vertexPtr = vertexManager.Alloc(g.vertexAttributes, vertexCount)
               let vertexRange = Range1i(int vertexPtr.Offset, int vertexPtr.Offset + vertexCount - 1)
               for (KeyValue(k,v)) in g.vertexAttributes do
                    let target = getVertexBuffer k
                    target.Add(vertexRange, v) |> ds.Add
   
  -            let instancePtr = instanceManager.Alloc 1
  +            let instancePtr = instanceManager.Alloc(g.uniforms, 1)
               for (KeyValue(k,v)) in g.uniforms do
                    let target = getInstanceBuffer k
                    target.Add(int instancePtr.Offset, v) |> ds.Add
   
  -            let indexPtr = indexManager.Alloc fvc
  +            let indexPtr = indexManager.Alloc(g.indices, fvc)
               let indexRange = Range1i(int indexPtr.Offset, int indexPtr.Offset + fvc - 1)
               indexBuffer.Add(indexRange, g.indices) |> ds.Add
   
  
positive.code: 
  
      let testSg (r : IRuntime) =
          let pool = ManagedPool r
  
          let geometry (pos : V3d) =
              let g = Primitives.unitSphere 0 |> AdaptiveGeometry.ofIndexedGeometry
              g.uniforms.[Sym.ofString "Hugo"] <- Mod.constant ((M44d.Translation pos * M44d.Scale 0.1) |> M44f.op_Explicit)
              g
  
          let s = 30.0
          let drawCalls =
  
negative.code:         interface IMod<IBuffer> with
              member x.GetValue c = x.GetValue c
  
      type LayoutManager<'a>() =
          let manager = MemoryManager.createNop()
          let store = Dict<'a, managedptr>()
          let cnts = Dict<managedptr, 'a * ref<int>>()
  
  
          member x.Alloc(key : 'a, size : int) =
              match store.TryGetValue key with
                  | (true, v) -> 
                      let _,r = cnts.[v]
                      Interlocked.Increment &r.contents |> ignore
                      v
                  | _ ->
                      let v = manager.Alloc size
                      let r = ref 1
                      cnts.[v] <- (key,r)
                      store.[key] <- (v)
                      v
  
          member x.Free(value : managedptr) =
              match cnts.TryGetValue value with
                  | (true, (k,r)) ->
                      if Interlocked.Decrement &r.contents = 0 then
                          cnts.Remove value |> ignore
                          store.Remove k |> ignore
                  | _ ->
                      ()
  
  
      type ManagedPool(runtime : IRuntime, signature : GeometrySignature) =
          let mutable count = 0
          let indexManager = LayoutManager<BufferView>()
          let vertexManager = LayoutManager<Attributes>()
          let instanceManager = LayoutManager<Uniforms>()
  
          let indexBuffer = new ManagedBuffer(runtime)
          let vertexBuffers = SymbolDict<ManagedBuffer>()
          let instanceBuffers = SymbolDict<ManagedBuffer>()
          let isEmpty = Mod.init true
  
  
          let getVertexBuffer (sym : Symbol) =
              vertexBuffers.GetOrCreate(sym, fun sym -> new ManagedBuffer(runtime))
  
          let getInstanceBuffer (sym : Symbol) =
              instanceBuffers.GetOrCreate(sym, fun sym -> new ManagedBuffer(runtime))
  
  
          member x.IsEmpty = isEmpty :> IMod<_>
  
  