Thread: memory leaks

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    25

    memory leaks

    In the last two weeks i had made several trees and graph prog. i am not good with pointers so i had to struggle a lot.but now i am observing some issues with my prog in dev c++. like for ex:- i made a prog which has to print fibonaaci series but when i write getch(); inside the loop so that each number of series appear one by one,the program freezes and shut down immediately,without that it works fine. like that many abnormal things are happening -sometimes i found the compilation slow also as compared to usual.is it happening due to misuse of pointers or is the heap memory is low or exhausted?is there any software to find out the memory leaks or memory problems in system and to recover it.please help.

  2. #2
    Registered User
    Join Date
    Aug 2008
    Location
    Belgrade, Serbia
    Posts
    163
    Valgrind will probably help you solve any such problems you have, albeit there are no Windows ports, which I presume you use. You could also show us the source.
    Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
    What profit hath a man of all his labour which he taketh under the sun?
    All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
    For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.

  3. #3
    Registered User
    Join Date
    Aug 2011
    Posts
    25
    i downloaded that but how to run it.where is the .exe file.

  4. #4
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    203
    Quote Originally Posted by shikhardeep View Post
    i downloaded that but how to run it.where is the .exe file.
    Do you read?

    albeit there are no Windows ports
    therefore no .exe (Windows Executable)
    How to ask smart questions
    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Post the code.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Banned
    Join Date
    Nov 2011
    Posts
    3
    Hey why you doesn’t use nothing for monitoring memory leaks? Especially if you work includes graphical objects?

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    StarDrago, I note that the last post prior to yours in this thread was made two weeks ago. You should not revive old threads unless there is truly something that you must contribute to the discussion. But I do have such a thing...

    Quote Originally Posted by shikhardeep
    i am not good with pointers so i had to struggle a lot.
    Design also plays a part: How do I deal with memory leaks?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Banned
    Join Date
    Nov 2011
    Posts
    3
    <<spammage snipped>>
    Last edited by StarDrago; 11-26-2011 at 03:59 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory usage and memory leaks
    By vsanandan in forum C Programming
    Replies: 1
    Last Post: 05-03-2008, 05:45 AM
  2. Odd memory leaks
    By VirtualAce in forum C++ Programming
    Replies: 11
    Last Post: 05-25-2006, 12:56 AM
  3. Memory leaks
    By Malek in forum C++ Programming
    Replies: 2
    Last Post: 02-09-2003, 06:12 PM
  4. Memory leaks...
    By TonyP in forum C++ Programming
    Replies: 1
    Last Post: 12-22-2002, 02:23 PM
  5. Memory leaks
    By Eber Kain in forum C++ Programming
    Replies: 3
    Last Post: 12-20-2001, 12:58 PM