ブックのアンマネージリソースを解放する
Contents
[
Hide
]
Aspose.Cellsは、Workbook.dispose()メソッドを提供しており、Workbookオブジェクトのアンマネージリソースを解放します。 disposeパターンは、ファイルやパイプハンドル、レジストリハンドル、ウェイトハンドル、アンマネージメモリブロックへのポインタなど、アンマネージリソースにアクセスするオブジェクトにのみ使用されます。これは、ガベージコレクタが未使用の管理オブジェクトを効率的に回収できるが、アンマネージオブジェクトを回収できないためです。
ブックのアンマネージリソースを解放する
以下のサンプルコードは、Workbook.dispose()メソッドの使用方法を示しています。
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(); | |