OnSetAllocationSize event/delegate/callback


Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

CBFSConnect     See also    


This event is fired when the OS or the application needs to set the allocation size of the file.


    property OnSetAllocationSize : TCBSetAllocationSizeEvent;
    TCBSetAllocationSizeEvent = procedure( Sender : TObject; FileInfo: TCBFileInfo; AllocationSize: Int64 ) of object;

[C++ (Lib)]
    void (__stdcall *CBSetAllocationSizeEvent)(void* Sender, CBFileInfo* FileInfo, long long AllocationSize );

[C++ (VCL)]
    typedef void (__closure *TCBSetAllocationSizeEvent)( System::TObject* Sender, TCBFileInfo* FileInfo, __int64 & AllocationSize );

[C++ (.NET)]
    public __delegate void CBSetAllocationSizeEvent( CBFSConnect^ Sender, CBFileInfo^ FileInfo, Int64 AllocationSize );

    public void CBSetAllocationSizeEvent( CBFSConnect Sender, CBFileInfo FileInfo, Int64 AllocationSize );

    Sub CBSetAllocationSizeEvent( ByVal Sender As CBFSConnect, ByVal FileInfo As CBFileInfo, ByVal AllocationSize As Int64 )

    void ICbFsFileEvents.onSetAllocationSize( CBFSConnect sender, CBFileInfo fileInfo, long allocationSize );


  • Sender - reference to the class that called the delegate/event handler
  • FileInfo - contains the information about the file
  • AllocationSize - the size of the space, allocated for the file. This size in most cases will be larger than the actual file size.


This event is fired when the OS or the application needs to set the allocation size of the file.
Read more about contexts.

AllocationSize is usually larger (and much larger) than the size of the file data. This happens because some file operations first reserve space for the file, then start writing actual data to this file. The application should track such situations and avoid re-allocating file space where possible to improve speed.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CBFS Connect.

See also

GetHandleInfo method     OnCloseFile event     OnCreateFile event     OnOpenFile event     OnSetEndOfFile event     OnSetValidDataLength event