[Solved] Question on memory heap

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
zodiac976
Chaos Rift Regular
Chaos Rift Regular
Posts: 156
Joined: Thu Jun 18, 2009 10:03 am
Current Project: Booklet & Text RPG
Favorite Gaming Platforms: PC, PS3, PSP
Programming Language of Choice: C++
Location: AL
Contact:

[Solved] Question on memory heap

Post by zodiac976 »

If I make a variable into the memory heap will it keep
its value like when I declare a static variable which
keeps any value stored in it for the life of the program?
Last edited by zodiac976 on Mon Jun 29, 2009 8:08 pm, edited 1 time in total.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Question on memory heap

Post by avansc »

no offence. but you need to ask google these kinda things. you will get the answer alot quicker. and google wont give you asshole remarks like me.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
zodiac976
Chaos Rift Regular
Chaos Rift Regular
Posts: 156
Joined: Thu Jun 18, 2009 10:03 am
Current Project: Booklet & Text RPG
Favorite Gaming Platforms: PC, PS3, PSP
Programming Language of Choice: C++
Location: AL
Contact:

Re: Question on memory heap

Post by zodiac976 »

Yea I should just use google and not post any questions anymore.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Question on memory heap

Post by avansc »

zodiac976 wrote:Yea I should just use google and not post any questions anymore.
dont be a little baby about it. i didnt say never ask anything. i said these kinda questions. arent you like in your mid 20's.. and still acting like a little girl that just had her first period in gym class. grow a sack.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Question on memory heap

Post by eatcomics »

Avan is , sorta, right, these kind of questions would be better for google, it's a very short question easily searched on google... it would take ten seconds on their apposed to 5 minutes for a first post like avans, and then another 12 minute argument, then an answer that someone else got from google....
Image
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Question on memory heap

Post by MarauderIIC »

zodiac976 wrote:If I make a variable into the memory heap will it keep
its value like when I declare a static variable which
keeps any value stored in it for the life of the program?
Yes but once the pointer to it goes out of scope, you effectively won't be able to access it anymore. Which means you won't be able to delete it. Which means you'll have a memory leak. (Every new that is executed must have an accompanying delete.)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply