Raised This Month: $ Target: $400
 0% 

arrays/strings memory usage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
commonbullet
Veteran Member
Join Date: Oct 2005
Old 11-06-2005 , 08:47   arrays/strings memory usage
Reply With Quote #1

consider the 3 situations:
Quote:
1: new test[32]
2: format (test,8,"testing")
3: format (test,1,"t")
Is there any difference in memory space used by "test" variable? or maybe the space is reserved in 1) (?) and it doesn't change.
commonbullet is offline
Send a message via ICQ to commonbullet Send a message via MSN to commonbullet
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 11-06-2005 , 10:57   Re: arrays/strings memory usage
Reply With Quote #2

Quote:
Originally Posted by commonbullet
consider the 3 situations:
Quote:
1: new test[32]
2: format (test,8,"testing")
3: format (test,1,"t")
Is there any difference in memory space used by "test" variable? or maybe the space is reserved in 1) (?) and it doesn't change.
There is no memory space difference between these two. new test[32] in a function reserves space for 32 elements on the stack (the stack is pre-allocated as well; the compiler estimates the stack usage; it should alloc more than needed, especially if recursion is involved)

new test[32] on the global scope would add 32 cells to the data section.
__________________
hello, i am pm
PM is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 11-06-2005 , 11:15  
Reply With Quote #3

Scratch this...
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-06-2005 , 13:56  
Reply With Quote #4

what?
XxAvalanchexX is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 11-06-2005 , 14:15  
Reply With Quote #5

when you use format() the way that you used it, it starts over with 't' as the only char in the string. so now Zenith thats incorrect.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Zenith77
Veteran Member
Join Date: Aug 2005
Old 11-06-2005 , 14:18  
Reply With Quote #6

whoops, i completly mis understood him, thought ahh nm... to hard to explain...
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
commonbullet
Veteran Member
Join Date: Oct 2005
Old 11-06-2005 , 14:44  
Reply With Quote #7

Thank you.
commonbullet is offline
Send a message via ICQ to commonbullet Send a message via MSN to commonbullet
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode