locked
Memory leak from third party DLL RRS feed

  • Question

  • Hi,

    Our .NET application has a c++/cli project uses a third party DLL (from Intel, a native c++ DLL), the DLL has memory leak, memory will go up to 10G after running for 24 hours.

    we have to use the DLL, and the same time it's not allowed to restart our application; since it's a unmanaged memory leak, app domain may not help to clear the memory.

    the options I have:

    1. find time to restart the application.

    2. run the leak code in another process, and restart the process

    the first options may lost some state and has risk to restore all the context; the second options, if invoke method from other process use remoting, it may cause some delay, and take time to wrap everything.

    any suggestion?

    Wednesday, July 4, 2012 5:06 AM

Answers

  • My first question is - Is that memory leak really out of your control? ReVerify your code to check you are properly disposing the handles.

    Anyways, if memory leak is unavoidable, then I would go with second option because I think that extra delay is better than restarting the application.


    Please mark this post as answer if it solved your problem. Happy Programming!

    • Marked as answer by xhuan8 Thursday, July 5, 2012 9:50 AM
    Wednesday, July 4, 2012 5:37 AM

All replies

  • My first question is - Is that memory leak really out of your control? ReVerify your code to check you are properly disposing the handles.

    Anyways, if memory leak is unavoidable, then I would go with second option because I think that extra delay is better than restarting the application.


    Please mark this post as answer if it solved your problem. Happy Programming!

    • Marked as answer by xhuan8 Thursday, July 5, 2012 9:50 AM
    Wednesday, July 4, 2012 5:37 AM
  • I'm surprized that Intel would have a dll that would create a memory leak.  Has Intel posted any place that one of there products has a memory leak?  It may be the way you are using the dll that is creating the memory leak and not the actual dll.  The software engineers at Intel probably understand memory leaks better than most people and know how to avoid these leaks.

    Lots of people make a common mistake that managed code will not create memory leaks and unmanaged code will create memory leaks.  I have seen both managed and unmanaged code produce memory leaks.  I have seen lots of dlls run wothout memory leaks.  When a dll is used improperly it can cause memory leaks.  It doesn't mean the dll is the root cause of the memory leak.

    The memory that is leaking is probably not in the dll but in your application code.  Usually all memory that dll uses is allocated in the application that calls the dll and not in the dll itself.  After you call a dll you must dispose of the memory allocated to the dll before calling the dll again.


    jdweng

    • Proposed as answer by Mike Feng Thursday, July 5, 2012 7:09 AM
    Wednesday, July 4, 2012 5:42 AM