The 'Pawn Language' Forum
An embedded scripting language
| Reply To This Topic Back To Forum Index |
|
Steen Larsen
|
Posted On 2010-01-04 02:53 -- Subject: String memory usage... Hi I have been adding the Pwan to my project and it seems to be going well. But then I start working with strings and then I was up for a big surprise. Whenever I create a string, const or not it occupies “global” data memory. I was expecting that const strings and strings “hardcoded” in functions not used any “global” data. E.g. strlen(“Hello World”) I can see that when I create normal variables like:“new I”, in a function this do not occupies any global memory. Any suggestion to what I do wrong or if this is working as expected? Regards Steen |
|
Steen Larsen
|
Posted On 2010-01-05 09:32 -- Subject: RE: String memory usage... Hi I have been looking a bit on this problem and found that basic my problem are that whenever I create a array and initialize it with something like: new f[2]= {1,2} new d[50 char] = 'Test data' The init data are all stored in the "global" data section. But if I do like this: new s = 3 The init value is not stored in the "global" data section. Is there any easy way of making the init of the array the same way? Regards Steen |
BAILOPAN
![]() website |
Posted On 2010-01-05 16:47 -- Subject: RE: String memory usage... Where else would it go? It has to be initialized from somewhere. |
|
Steen Larsen
|
Posted On 2010-01-06 08:07 -- Subject: RE: String memory usage... Hi I was hoping that the init of the variabels coudt be stored in the the "code ram" and not in the "global ram". This way when one uses overlay you can reduce the overall memmory foodprint!? Regards Steen |
|
incrediball
|
Posted On 2010-01-10 20:04 -- Subject: RE: String memory usage... Agreed, storing the string along with the code would be better for code overlaying. The documentation explicitly states that multiple identical strings will be stored multiple times (and not just once) so in this case there would be no problem with them being out of reach of other functions if they are stored in an overlay. |
| You Are On Page: 1/1 | << < 1 > >> |
- BiTBOARD version 2.5 by the
BiTSHiFTERS SDC -