cog memory assignment
Hello,
what is the best way to check if you are using enough memory assigned to a cog?
Here is what I've done and I don't really know if it's an efficient way to do it:
I have six cogs running simultaneously; each with a different amount of memory assigned.
I've assigned memory this way...
- After I "View Info" (F8) I can click on any block of code to see the amount of memory it uses (listed in bytes displayed at bottom of screen).
- I divide this value of bytes by four to figure out how much memory it is in long.
- Finally, I know that the prop can hold 5240 long of code so I just subtract each amount of long each block of code takes up (plus a little·added padding.)
For example...
...a block of code takes up 400 bytes of memory...
...I divide this by 4 to get the equivalent of the amount of code - 100 long...
...I then double this value to 200... (just in case - extra padding)...
...finally, this block of code is "mapped" to a memory location of 5140 (5240-100=5140)
· ie··· cognew(Wireless_Input, @stack[noparse][[/noparse]5140]).
Is this a good way to manage this?
Thanks,
Shmow
what is the best way to check if you are using enough memory assigned to a cog?
Here is what I've done and I don't really know if it's an efficient way to do it:
I have six cogs running simultaneously; each with a different amount of memory assigned.
I've assigned memory this way...
- After I "View Info" (F8) I can click on any block of code to see the amount of memory it uses (listed in bytes displayed at bottom of screen).
- I divide this value of bytes by four to figure out how much memory it is in long.
- Finally, I know that the prop can hold 5240 long of code so I just subtract each amount of long each block of code takes up (plus a little·added padding.)
For example...
...a block of code takes up 400 bytes of memory...
...I divide this by 4 to get the equivalent of the amount of code - 100 long...
...I then double this value to 200... (just in case - extra padding)...
...finally, this block of code is "mapped" to a memory location of 5140 (5240-100=5140)
· ie··· cognew(Wireless_Input, @stack[noparse][[/noparse]5140]).
Is this a good way to manage this?
Thanks,
Shmow
Comments
Edit: Was he talking about the stack ?... well, my bad.
Post Edited (Ale) : 9/10/2008 2:36:45 PM GMT
I recommend you use a separate stack array for each cog (like "Wireless_Input_Stack", "Other_Cog_Stack")