Results 1 to 5 of 5

Thread: Testing for memory leaks

  1. #1

    Thread Starter
    Addicted Member Porsche944's Avatar
    Join Date
    Apr 2005
    Location
    Ann Arbor
    Posts
    182

    Question Testing for memory leaks

    What is the best way to test for memory leaks in your program?

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Testing for memory leaks

    If you don't want memory leaks, then do use any of the .Net languages. They don't suffer from memory leaks due to the memory management (Garbage Collector).

    And you can't test for memory leaks by definition anyway, that would imply that you know where the wild pointers are pointing, hence no leak.
    I don't live here any more.

  3. #3

    Thread Starter
    Addicted Member Porsche944's Avatar
    Join Date
    Apr 2005
    Location
    Ann Arbor
    Posts
    182

    Re: Testing for memory leaks

    Memory leaks can still be caused by .Net. The garabe collector will free any memory from unused objects. However that is a poor programming practice to just let objects fly around with no reguard to properly disposing them. Surely there must be some utility out there that can give you some information on a possible leak in your code.

  4. #4
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: Testing for memory leaks

    Quote Originally Posted by Porsche944
    Memory leaks can still be caused by .Net. The garabe collector will free any memory from unused objects. However that is a poor programming practice to just let objects fly around with no reguard to properly disposing them. Surely there must be some utility out there that can give you some information on a possible leak in your code.
    you could certainly look at the memory usage for the app in the task manager. If indeed you have stray objects not being relinquished, then in time your app should consume more and more memory. Another app that gives lots of memory usage is the process viewer that shipped with Visual Studio 6.0 tool set.
    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  5. #5
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: Testing for memory leaks

    Strictly speaking, letting objects lying around unused isn't a memory leak, just sloppy programming. Like wossname has indicated, memory leaks are not possible in .Net - however that doesn't mean that the garbage collector acts in ways that make sense (well, common sense anyway ).

    There are several utilities that you can use to profile .Net apps (out of the top of my head I would recommend CLR Profiler). Also, take a look at the performance monitor, there are a bunch of .Net counters that involve memory metrics.
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width