Closed SavoFortech closed 1 month ago
I'm pretty sure we shouldn't call Marshal.FreeHGlobal
on GetConversionResult
since the buffer is allocated in the native library, vs the other places where Marshal.Copy
is used where we allocate memory with Marshal.AllocHGlobal
. It sounds more like your issue is that you're not using the SynchronizedConverter
.
hi, thank you for reply, im instantiate it in startup.cs for my DI with:
services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));
But we face with the problem very very rarely, normally it works well. For this reason we are thinking in a sort of race condition
Ok, yeah that is correct. I don't have any other ideas on what may cause your issue, since this is just a wrapper around the native library, it is possible there is an issue in the native library, or an issue with the interop.
Sorry, for not replying to you but the issue never prompt anymore and i forget about this ticket. If we face with the problem again in the future we will try to investigate more. Thanks for your time.
hi, we have noticed that if we call the convesion for two html in the same time, sometimes happens that the second one will be generated with errors, specifically, the second one, is generated correctly but seems that a "piece" of the first one is been appended to it.
Watching the implementation we noticed that the method GetConversionResult, in the PdfTools class, doesn't call the "Marshal.FreeHGlobal", like other method does after has been called the "Marshal.Copy" function.
Can you pleade check if it'll be make sense add "Marshal.FreeHGlobal" GetConversionResult?