Discuss this help topic in CBFS Forum

OnSetAllocationSize event/delegate/callback


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

CallbackFileSystem     See also    


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


    property OnSetAllocationSize : TCbFsSetAllocationSizeEvent;
    TCbFsSetAllocationSizeEvent = procedure( Sender : TObject; FileInfo: TCbFsFileInfo; AllocationSize: Int64 ) of object;

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

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

[C++ (.NET)]
    public __delegate void CbFsSetAllocationSizeEvent( CallbackFileSystem^ Sender, CbFsFileInfo^ FileInfo, Int64 AllocationSize );

    public void CbFsSetAllocationSizeEvent( CallbackFileSystem Sender, CbFsFileInfo FileInfo, Int64 AllocationSize );

    Sub CbFsSetAllocationSizeEvent( ByVal Sender As CallbackFileSystem, ByVal FileInfo As CbFsFileInfo, ByVal AllocationSize As Int64 )

    void ICbFsFileEvents.onSetAllocationSize( CallbackFileSystem sender, CbFsFileInfo 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 Callback File System.

See also

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

Discuss this help topic in CBFS Forum