Hi.
This might seem like an odd request because normally this is stuff you should keep track off while developing...
But my program just recently went from 2 MB RAM usage to 90 MB. On a modern PC that is not noticed, but on a five year old that really affects the user experience.
So my question is:
Is there a easy way to list all arrays/maps/lists used and see their memory usage so I can see which one is taking up all that memory?
String/array memory usage
-
- Enthusiast
- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
Re: String/array memory usage
put in a breakpoint and use the variable viewer? (I think it gives some info on lists and arrays, so I guess it might do maps too)
there is no sig, only zuul (and the following disclaimer)
WARNING: may be talking out of his hat
WARNING: may be talking out of his hat
Re: String/array memory usage
Hi,
add a keyboard shortcut and than build a Text$ with the help of ArraySize() ListSize() and MapSize()
and at least use MessageRequester() to show the values.
Bernd
add a keyboard shortcut and than build a Text$ with the help of ArraySize() ListSize() and MapSize()
and at least use MessageRequester() to show the values.
Bernd
-
- Enthusiast
- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
Re: String/array memory usage
I see my problem is in a array (probably) like one of those
With the ones that are integer, long etc i have no problem figuring out the size of them, but with strings - is there a smart way?
Code: Select all
global dim jesper.s(999,99)
Re: String/array memory usage
You need to iterate through the array and sum up the length of each string. Also don't forget to add the memory required for the pointers
to actually reference the strings.
I don't think there is any other way.
to actually reference the strings.

Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Re: String/array memory usage
For Windows
1- Include the next code into a Procedure
2- Call the Procedure after each use of ( Arrary,LinkedList,Map,.... )
3- Write the result to a Log File
You can get the memory hungry act from the log
1- Include the next code into a Procedure
2- Call the Procedure after each use of ( Arrary,LinkedList,Map,.... )
3- Write the result to a Log File
You can get the memory hungry act from the log
Code: Select all
Memory.MEMORYSTATUSEX
Memory\dwLength.l = SizeOf (Memory)
GlobalMemoryStatusEx_(Memory.MEMORYSTATUSEX)
Debug "Available Physical Installed : "+Str(Memory\ullAvailPhys.q /1024/1024) + " MB"
Debug "Free of Paging File : "+Str(Memory\ullAvailPageFile.q/1000000)
Egypt my love