Closed Airex closed 3 years ago
I purpose to change "delegates" to
//used to maintain a reference to delegates to prevent them being garbage collected...
private readonly ConcurrentDictionary<IntPtr, List<object>> delegates = new ConcurrentDictionary<IntPtr, List<object>>();
and use
public void DestroyConverter(IntPtr converter)
{
this.delegates.TryRemove(converter, out var l);
l?.Clear();
this.module.wkhtmltopdf_destroy_converter(converter);
}
to free associated delegates
Please submit PR for review
I've implemented this now in version 1.3.0, please verify.
in case of using of SynchronizedConverter PdfTools is as singleton and contains _Delegates member that is never cleared and list just fills with delegates on each conversion
_Delegates.Clear(); in DestroyConverter should remove this issue