Rank: Newbie
Groups: Registered
Joined: 5/12/2023(UTC) Posts: 2 Location: NH
|
Hello! So below I have a accessor method called "DefaultSetMetadata". When the Get is called, it returns the current page information that I then use to update and display in the UI. I am using a pdf file that is 500k documents but I believe the size of the job doesn't matter. I seem to have a memory leak that is something like 2MB a second and when run overnight, will take up 70GB. If I make this method return an empty dictionary, the leak goes away. I have tried the C# Using statement and also explicit Dispose(). I notice that if I call IsDispose() after the Using statement, it returns false. Any advice or is this a known bug? FYI, I load the PdfDoc in another method like this: pdfStream = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); PdfDoc = PdfDocument.Load(pdfStream); Code:
public Dictionary<string, string> DefaultSetMetadata
{
get
{
try
{
if (PdfDoc == null)
{
return null;
}
defaultMetadata.Clear();
using PdfTypeDictionary PieceInfoDictionary = PdfDoc.Pages[(DocumentNumber * DocumentSize) - 1].Dictionary.GetBy("PieceInfo") as PdfTypeDictionary;
if (PieceInfoDictionary.Count == 0)
{
return defaultMetadata;
}
if (PieceInfoDictionary.ContainsKey("MDPS:MetaDataDefaultSet"))
{
using PdfTypeDictionary DefaultSetDictionary = PieceInfoDictionary.GetBy("MDPS:MetaDataDefaultSet") as PdfTypeDictionary;
if (DefaultSetDictionary.ContainsKey("Private"))
{
using PdfTypeDictionary DefaultMetadataDictionary = DefaultSetDictionary.GetBy("Private") as PdfTypeDictionary;
foreach (string name in DefaultMetadataDictionary.Keys)
{
defaultMetadata.Add(name, ((PdfTypeString)DefaultMetadataDictionary.GetBy(name)).UnicodeString);
}
}
}
return defaultMetadata;
}
catch (Exception ex)
{
return new Dictionary<string, string>();
}
}
}
Edited by moderator Tuesday, May 23, 2023 8:19:44 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,104
Thanks: 7 times Was thanked: 129 time(s) in 126 post(s)
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 5/12/2023(UTC) Posts: 2 Location: NH
|
Hi Paul, I have created this console app for you and emailed it. How do I get the PDF to you? It is larger then I can put in email at 100mb. Thanks Edited by user Wednesday, May 24, 2023 3:55:32 PM(UTC)
| Reason: Not specified
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close