Quantcast
Channel: Aspose.Email Product Family
Viewing all articles
Browse latest Browse all 1367

Getting JAVA Heap Exception for traversing folders and mails from pst file

$
0
0
Hi,

I am trying to extract all mails from   1.82 GB  pst file as follows,

FolderInfo folderInfo = this._personalStorage.getRootFolder();

traverse(folderInfo, folder);

....

void traverse(FolderInfo  folderInfo) {

if (folderInfo.hasSubFolders() == true) {
    IGenericEnumerable<MapiMessage> collection =folderInfo.enumerateMapiMessages();

    iterateCollectionToExtractData(); // This code takes nearly around 1 gb memory
            for (int i = 0; i < folderInfo.getSubFolders().size(); i++) {
FolderInfo subfolderInfo = (FolderInfo) folderInfo .getSubFolders().get_Item(i);
traverse(subfolderInfo );
     }
}

Facing the 
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.aspose.email.MapiProperty.b(SourceFile:807)
at com.aspose.email.ane.a(SourceFile:1811)
at com.aspose.email.ane.a(SourceFile:224)
at com.aspose.email.ane.b(SourceFile:1920)
at com.aspose.email.ane.a(SourceFile:2293)
at com.aspose.email.ane.a(SourceFile:279)
at com.aspose.email.ane$c.hasNext(SourceFile:3333)

Please let me know any other way to handle heap exception

Viewing all articles
Browse latest Browse all 1367

Trending Articles