Every now and then, ABCpdf runs out of memory

2019-04-14 07:03发布

The project I'm on is using a 3rd party component to build dynamic PDFs in a VB.Net web system called ABCpdf.Net. (not a terrible tool, but not a great one either.)

Every now and then, for reasons I can't fathom, the document object throws a SEHException. Digging futher, it turns out this is caused by a custom exception in the document object of the type WebSupergoo.ABCpdf6.Internal.PDFException. The contents contains only the not -terribly-helpful title "Unable to get image data. Out Of Memory" Usually this happens when trying to add an image to the PDF. Since these images are PNGs of less than 100k, I'm guessing their size isn't the issue.

Also, the really strange thing is that once this issue starts happening, the only way to get it to stop seems to be to reboot the web server, which is clearly a little sub-par.

Has anyone ever had this problem (or even used this tool?)

3条回答
啃猪蹄的小仙女
2楼-- · 2019-04-14 07:27

Update, three months later:

As near as I can tell, the memory issues were all resolved when we upgraded from ABCpdf 6 to 7. It would seem that version 7 is no longer a COM object with a .NET wrapper, but all managed code from the bottom up. It's still not the greatest PDF generator out there, but the resource disposal problems seem to have been resolved.

查看更多
放荡不羁爱自由
3楼-- · 2019-04-14 07:28

I haven't specifically seen this error before, but we've had memory issues with ABC PDF before.

Long story short is that it is NOT a completely managed code base, but simply a .NET wrapper around their COM version. That being said, we traced our memory usage problem to not disposing of their objects properly.

So, instead of:


Dim doc As New Doc()
'etc...

do this:


    Dim doc as Doc
    Using doc As New Doc()
      'etc...
    End Using
查看更多
贼婆χ
4楼-- · 2019-04-14 07:44

Fascinating. I had come to the conclusion that was what must be going on. Do you still call the doc.Clear() at the end of the using block?

查看更多
登录 后发表回答