6 Replies - 443 Views - Last Post: 10 May 2010 - 06:52 PM Rate Topic: -----

#1 Guest_Alex*


Reputation:

Memory Leaks

Posted 10 May 2010 - 12:11 PM

If a program causes a memory leak, is the memory never available again? Or will it be used eventually?
Is This A Good Question/Topic? 0

Replies To: Memory Leaks

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3093
  • View blog
  • Posts: 19,139
  • Joined: 14-September 07

Re: Memory Leaks

Posted 10 May 2010 - 12:16 PM

While the program is running, the memory isn't accessible because you didn't free it and the handle is gone. Usually the OS will free everything allocated to your program once the program ends, so it'll be available again. In the worst case scenario, the system crashes and on reboot everything is back to "normal".
Was This Post Helpful? 0
  • +
  • -

#3 eker676  Icon User is offline

  • Software Engineer
  • member icon

Reputation: 378
  • View blog
  • Posts: 1,833
  • Joined: 18-April 09

Re: Memory Leaks

Posted 10 May 2010 - 12:17 PM

No,

From the wiki page:

Quote

Memory leaks may not be serious or even detectable by normal means. In modern operating systems, normal memory used by an application is released when the application terminates. This means that a memory leak in a program that only runs for a short time may not be noticed and is rarely serious.


http://en.wikipedia....iki/Memory_leak
Was This Post Helpful? 0
  • +
  • -

#4 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3093
  • View blog
  • Posts: 19,139
  • Joined: 14-September 07

Re: Memory Leaks

Posted 10 May 2010 - 12:19 PM

I disagree with wiki's statement, they are very serious, even if minuscule. They arise from design flaws and programmer error ineptitude.
Was This Post Helpful? 0
  • +
  • -

#5 trixt.er  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 52
  • View blog
  • Posts: 426
  • Joined: 28-September 08

Re: Memory Leaks

Posted 10 May 2010 - 12:20 PM

It depends on what type of a memory leak you have. If the memory leak is allocating more memory than the program could eventually crash. Even if you're good at using pointers, there is still the risk of creating a memory leak.
Was This Post Helpful? 0
  • +
  • -

#6 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1072
  • View blog
  • Posts: 4,532
  • Joined: 09-June 09

Re: Memory Leaks

Posted 10 May 2010 - 12:24 PM

" If the memory leak is allocating more memory than the program could eventually crash"

that does not make sense
Was This Post Helpful? 0
  • +
  • -

#7 Guest_c.user*


Reputation:

Re: Memory Leaks

Posted 10 May 2010 - 06:52 PM

a memory leak can accumulate reserved by the program memory
if a program requires 1Mb at all, it can grow up from 1Mb to 100Mb due to a memory leak

This post has been edited by c.user: 10 May 2010 - 06:53 PM

Was This Post Helpful? 0

Page 1 of 1