memory leak with static allocation

is memory leak possible with static memory allocation

Page 1 of 1

5 Replies - 2491 Views - Last Post: 30 October 2008 - 03:50 PM Rate Topic: -----

#1 karminder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-October 08

memory leak with static allocation

Post icon  Posted 29 October 2008 - 10:38 PM

could nyone plz tell me is memory leak possible with static memory allocation
Is This A Good Question/Topic? 0
  • +

Replies To: memory leak with static allocation

#2 KYA  Icon User is offline

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

Reputation: 3116
  • View blog
  • Posts: 19,153
  • Joined: 14-September 07

Re: memory leak with static allocation

Posted 30 October 2008 - 06:33 AM

anytime you incorrectly assign and design pointers you could create a memory leak. The allocation does not necessarily have to be dynamic.
Was This Post Helpful? 0
  • +
  • -

#3 Psionics  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 13
  • View blog
  • Posts: 158
  • Joined: 06-September 08

Re: memory leak with static allocation

Posted 30 October 2008 - 10:42 AM

Dynamic memory is allocated whenever you use the keyword new. It must be 'coupled' with the keyword delete.

As a general rule, anytime you use new with [], you must delete with [].
Was This Post Helpful? 0
  • +
  • -

#4 KYA  Icon User is offline

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

Reputation: 3116
  • View blog
  • Posts: 19,153
  • Joined: 14-September 07

Re: memory leak with static allocation

Posted 30 October 2008 - 10:43 AM

edit: nvm

This post has been edited by KYA: 30 October 2008 - 10:44 AM

Was This Post Helpful? 0
  • +
  • -

#5 Hyper  Icon User is offline

  • Banned

Reputation: 108
  • View blog
  • Posts: 2,129
  • Joined: 15-October 08

Re: memory leak with static allocation

Posted 30 October 2008 - 01:40 PM

View PostKYA, on 30 Oct, 2008 - 10:43 AM, said:

edit: nvm


Haha, you edited to "nvm" :D
Was This Post Helpful? 0
  • +
  • -

#6 KYA  Icon User is offline

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

Reputation: 3116
  • View blog
  • Posts: 19,153
  • Joined: 14-September 07

Re: memory leak with static allocation

Posted 30 October 2008 - 03:50 PM

Well, i didn't feel the need to labor on about the difference between dynamic and static memory allocation. Regardless, if you screw up a pointer you can have a memory leak.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1