anchor.diff:    TCPFClassPtr(FOwner).CPFFreeMem(FMemory);
   end;
   
  +{ TCPFWeights }
  +
  +{class} function TCPFWeights.NewInstance(const ACount: Cardinal; const Address: Pointer): PCPFWeights;
  +var
  +  One: Cardinal;
  +begin
  +  // allocate
  +  Result := CPFAlloc(SizeOf(TCPFWeights) - SizeOf(Single) + ACount * SizeOf(Single),
  +    Address);
  +
  +  // fill
  +  Result.RefCount := 1;
  +  Result.UpdateId := 1;
  +  Result.Count := ACount;
  +
  +  // default values
  +  PSingle(@One)^ := 1.0;
  +  FillCardinal(Pointer(@Result.Values[0]), ACount, One);
  +end;
  +
  +procedure TCPFWeights.Release(const Address: Pointer);
  +var
  +  Cnt: Cardinal;
  +begin
  +  if (@Self = nil) then Exit; 
  +
  +  Cnt := Self.RefCount;
  +  if (Cnt <> 1) then
  +  begin
  +    Dec(Cnt);
  +    Self.RefCount := Cnt;
  +  end else
  +  begin
  +    CPFFree(@Self, Address);
  +  end;
  +end;
   
   
   type
  
positive.code:   {$endif}
  {$endif}
  end;
  
  function CPFAlloc(const Size: NativeUInt; const Address: Pointer): Pointer;
  begin
  
negative.code:   {$ifNdef CPFLIB}
      FCallAddress := ReturnAddress;
    {$endif}
  
    // tile weigths
    FWeights.Current.Release(FCallAddress);
    FWeights.Default.Release(FCallAddress);
  
    // internal buffers
    FStartPoints.Buffer.Free;
  