CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2005
    Posts
    39

    Thumbs up Finding memory leaks

    can we efficiently find the memory leaks through task manager?
    is it a good way?

    thanks a lot
    RaviKishore.

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Finding memory leaks

    can we efficiently find the memory leaks through task manager?
    is it a good way?
    Well, there are probably better solutions. But, both the Task Manager and the Performance Monitor will help you a great deal with finding memory and resource (handles, gdi etc.) leaks.

    - petter

  3. #3
    Join Date
    May 2006
    Posts
    37

    Re: Finding memory leaks

    I've heard that both firefox and opera have memory leaks.

    I used both programs and i do agree that sometimes too many tabs are open at the same time, the memory will spike to the top.

    Anyone have the same experience with me or am the only one?

    What actually causes memory leaks?
    From what i know: using malloc() without ending it with free()

    Any other causes?

  4. #4
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Finding memory leaks

    Here are few combinations:
    • malloc - free
    • new - delete
    • VirtualAlloc - VirtualFree
    • HeapAlloc - HeapFree
    • LocalAlloc - LocalFree
    • GlobalAlloc - GlobalFree
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  5. #5
    Join Date
    Mar 2006
    Location
    You can guess, but it'll be wrong
    Posts
    12

    Re: Finding memory leaks

    Improper use of constructors and destructors
    Emiene Vous

  6. #6
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Finding memory leaks

    Quote Originally Posted by Emiene
    Improper use of constructors and destructors
    Can you give a single example for CTOR/DTOR implications, without putting the memory allocation/de-allocation stuff??
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  7. #7
    Join Date
    May 2006
    Posts
    37

    Re: Finding memory leaks

    Quote Originally Posted by Ajay Vijay
    Here are few combinations:[*]new - delete
    Can you show me how can this cause a problem?

    I have some experience with Java, and the "new" is used for defining new objects of a class. I think it is used for the same purpose in Visual C++ (correct me if i'm wrong). But in Java, i never see the need to "delete" after "new". Is it because Java does garbage collection and cleanup by itself while visual C++ doesn't?

  8. #8
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Finding memory leaks

    I have some experience with Java, and the "new" is used for defining new objects of a class. I think it is used for the same purpose in Visual C++ (correct me if i'm wrong). But in Java, i never see the need to "delete" after "new". Is it because Java does garbage collection and cleanup by itself while visual C++ doesn't?
    Absolutely. Java has its Runtime environment called JVM.
    C++ does NOT have anything as such. The runtime environment is the OS (unless it is attached to debugger, in that case Debugger is actually RTE).

    You have to delete the memory yourself. This is one of the reason why C/C++ gives manifold performance over Java and other "runtime needed" languages like C#, VB.NET etc.

    You'll find thousands of articles on the Internet about Java and C++ differences.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

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

Featured