![]() | ||
| Home | SwiftX Archive | SwiftForth Archive | |

How can the amount of memory used in a given section (i.e. that displayed by
.ALLOCATION on an INCLUDE BUILD (F8)) be determined for run-time use?
The word USED defined below determines the amount of memory allocated for
the SwiftX application . If used in an INTERPRETER word it can be run
after a build to precisely identify that memory which should not be
disturbed (e.g. by a destructive memory test).
HOST
: USED ( -- n ) @SECTION CELL+ @ CELL - TEMPSEC ! TEMPSEC @ORG @ TEMPSEC
>LO @ - ;
.ALLOCATION
Start End Size Used Unused Type Name
20000000 2003FFFF 262144 17876 244268 CDATA OPSYS
20040000 2004FFFF 65536 44 65492 IDATA CONST-DATA
20050000 2007FFFF 196608 3920 192688 UDATA EXT-UDATA ok
cdata used . 17876 ok
idata used . 44 ok
udata used . 3920 ok
However, if used in a TARGET word as a literal the value will be less than
the final desired amount (though accurate at that point in the compile).
When the word is run, it will do the wrong thing; in the example below it
would erase *used* memory (15990 to 17876).
TARGET
: EraseSomeUnusedCdata [ .ALLOCATION CDATA LIMITS DROP USED + ] LITERAL
10000 ERASE ;
INCLUDE BUILD
Start End Size Used Unused Type Name
20000000 2003FFFF 262144 15990 246154 CDATA OPSYS
20040000 2004FFFF 65536 44 65492 IDATA CONST-DATA
20050000 2007FFFF 196608 3916 192692 UDATA EXT-UDATA
Image CRC: A0378ABA
Start End Size Used Unused Type Name
20000000 2003FFFF 262144 17876 244268 CDATA OPSYS
20040000 2004FFFF 65536 44 65492 IDATA CONST-DATA
20050000 2007FFFF 196608 3920 192688 UDATA EXT-UDATA
ok
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe" to swiftx-request_at_forth.com
For list command help, send subject "help" to swiftx-request_at_forth.com
Message archives are located at http://www.forth.com/archive/swiftx
----------------------------------------------------------------------
This list is a forum for SwiftX users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Tue Dec 07 2004 - 12:21:12 PST
This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:50 PST