Memory leak

Hello Guys,

Recently, i had used a tools to detect memory leak for .net

And, it's said that i had a memory leak on exiting program.

The leak is mainly on hpz2ku10.dll and hpzpm310.dll but on different line/offset.

My question :

How to avoid this memory leak since i don't know which code causing this leak.
also, it's said that the total bytes leak is 75.104 bytes (75Kb), is this leak bad

Thanks guys for the answers.


Answer this question

Memory leak

  • Dennis Q

    quote from n0n4m3 :

    "The only kind of "memory leaks" that you can have is that if you keep references to objects and this is bad if they're on a function that is called many times during the program's cycle because your program's memory may rise to very high values."

    Can you give an example (by code)


  • lester1111

    Sure, one simple example would be have an array and keep adding new objects to it:

    // declaration of the array in your class
    ArrayList m_array;

    // adding an element to your array in some function that gets called a lot of times
    m_array.Add(new MyClass());

    If you don't clear the array and always keep a reference to it, then the memory that your program's taking will go up.


  • Harry Cunningham

    Those 2 dlls are from a HP printer driver in case that helps.


  • Dmitry N. Oleshko

    Hi, i use compuware devpartner

  • TrueTexan

    No, i think it's .dll from microsoft. I never made a .dll with such name.
    Offcourse, it easy for me if i made that .dll because i could checked the codes myself.







  • kebabbert

    Hi,
    if that dll is a .net dll made by you then you must analyse the code and see where you're keeping references to objects that you don't need anymore. In .net there aren't really memory leaks since you can't leave unreferenced allocated memory or else the garbage collector would delete that memory for you.

    The only kind of "memory leaks" that you can have is that if you keep references to objects and this is bad if they're on a function that is called many times during the program's cycle because your program's memory may rise to very high values.

    To avoid memory leaks you'll have to dispose the objects or assign it to null and the GC will free the memory for you.


  • plshn99

    hi,

    i want to ask you which tool is this because i'm suffering here in something like that but my problem is bigger than 75kb

    best regards



  • Memory leak