Hi guys,
I’m using Aspose Email v20.10 to extract these messages in PST file.
{Sample code}:
class Program
{
public static int ProcessFile(String inputFile)
{
PersonalStorage pst = null;
try
{
using(pst = PersonalStorage.FromFile(inputFile, true))
{
MessageInfoCollection messageInfoCollection = pst.RootFolder.GetContents();
messageInfoCollection.Clear();
messageInfoCollection = null;
}
}
catch(Exception ex)
{
}
finally
{
GC.WaitForPendingFinalizers();
System.GC.Collect();
if(pst != null)
{
pst.Dispose();
pst = null;
}
}
return 0;
}
static void Main(string[] args)
{
String inputFile = @"sample_files.pst";
// set license
License pstLicense = new License();
pstLicense.SetLicense("Aspose.Total.lic");
// press key to watching init resource
System.Console.WriteLine("press any key from keyboard to memory resource usage");
System.Console.Read();
for(int i = 0; i < 10000; i++)
{
// Creating thread to extract file
Thread t = new Thread(() =>
{
ProcessFile(inputFile);
});
t.Start();
t.Join();
}
System.Console.WriteLine("Finish process, waiting to exit...................");
System.Console.Read();
while(true)
{
}
}
}
Step to reproduce:
Step 1: Press any key from the keyboard, watching memory resource as below:
init_resource.png (23.1 KB)
The memory usage is 24,460 KB
Step 2: After the test finish, the console outputs the log “Finish process, waiting to exit…”, the memory usage as below:
current_resource.png (22.3 KB)
The memory usage is 110,036 KB
I run this code on Windows 10 64bit, Aspose Email 20.10
Please investigate this problem. Thanks. sample_files.zip (1.1 MB)