Free Support Forum -

eSigning API multiple calls issue in .NET

Hi @taxreturned let me share some performance results. Using previously attached tool I was able to leave it working for a long time (3-5 hours) with about 1M operation. You can check an example it calls the GC.Collect periodically. So far I do not see extremely memory leaks issue, for about 1M calls of the Sign method (based on preloaded bytes of document and certificate)
On start program used approximate 200Mb memory
after 1 hours and 500k calls the app used 400Mb memory and it stayed the same for 2 hours and 1M calls
It seems there’re some memory leaks for sure and we will try to fix it for the next 21.4 release.
But it doesn’t seem to be very extremely.
Please share your vision on this, if this sample simulates your code and could help understand an issue?
Thank you!


Thanks for your help.

As you can see from the attached screenshot, we get this when the call is executed simultaneously, once the memory leak happens the whole process gets stuck and won’t work until IIS is restarted. This is not a small memory leak as we can’t always keep restarting the iis.

image.png (46.8 KB)

@taxreturned, I see
Can you please compare with the attached project if the Sign procedure implemented different way?
I am trying to understand how to reproduce the issue with signature you are experiencing.
This sample project was run about 5 hours with 1000 copy of PdfSIgner instance and 1000 attempts of running them in parallel mode. So summary there were 1M calls of the Sign method and the memory kept approximate 400-500Mb size with no changes.
Just to confirm, platform is Core/Net Standard, right?
having this issue so often it looks like there’s recursive call of this.
May I ask you to include into the log some stack trace to double check of the error source ?

Sure, will add that. I don’t think it’s actually running out of memory as the server memory usage seems to be consistent while it was throwing these errors. Could it be that it’s reaching the limit of an internal memory structure? Like an overflow issue?

I have few suggestions for further investigation

  • double check there’s no recursive call - this is also when Out of Memory happens
  • check if Project doesn’t have [Prefer 32 bit] check box set
  • involve call stack to check the error source
  • set project as x64 cpu target / .Core
  • check on the latest GD Signature 21.3 version from nuget

There are no recursive calls and we’re using 21.3. I’ll add the stack trace to the logging.


Please see the stack trace attached:

image.png (64.9 KB)


Hi @taxreturned,

Let me summarize the possible points that help us to move forward with this issue. Kindly ask you to find few minutes and answer or suggest your vision on each of following items.

  1. The best way would be to share your project or sample project that reproduces an error on your side with the PDF file and certificate.

  2. I guess, this is issue is the Certificate / Pdf / OS related.
    Can you please share here or me personally on email ( the Certificate PFX file with private password.

  3. Try to use sample project shared few posts ago
    Put your PDF files and your PFX certificate inside the Files folder (PFX file should be only one!) and try to run on low numbers like

    var FILES_QTY = 5; // quantity of file to run
    var CYCLES_QTY = 1;// quanitty of cycles to repeat
    var SAVE_FILES = false;
    var VERIFY_FILES = true;certificate and validate it

  4. Share please more details of the OS and project

  • if this is Win server / version
  • OS is 64 bit?
  1. Can you please confirm if Web API project setting

Thank you for your patience!