Release Unmanaged Resources of the Workbook
Contents
[
Hide
]
Aspose.Cells provides Workbook.dispose() method to release the unmanaged resources of the Workbook object. The dispose pattern is used only for objects that access unmanaged resources, such as file and pipe handles, registry handles, wait handles or pointers to blocks of unmanaged memory. This is because the garbage collector is very efficient at reclaiming unused managed objects, but it is unable to reclaim unmanaged objects.
Release Unmanaged Resources of the Workbook
The following sample code shows how to make use of the Workbook.dispose() method.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(ReleaseUnmanagedResources.class); | |
// Create workbook object | |
Workbook wb1 = new Workbook(); | |
/* | |
* Call dispose method,It performs application-defined tasks associated with freeing, releasing, or resetting | |
* unmanaged resources. | |
*/ | |
wb1.dispose(); | |