ARM Technical Support Knowledge Articles

HOW MUCH MEMORY IS USED BY MY PROGRAM?

Applies to: General Topics

Answer


Information in this article applies to:


QUESTION

How can I find out how much memory is used by my program? I've looked in the map file but I can't figure it out.

ANSWER

The linker map file lists the total memory used by your program in each memory area. After compiling and linking your program, open the map file and search for Link Map. You will find a listing similar to the following:

LINK MAP OF MODULE:  HELLO (HELLO)


            TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
            -----------------------------------------------------

            * * * * * * *   D A T A   M E M O R Y   * * * * * * *
            REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
            DATA    0008H     0014H     UNIT         _DATA_GROUP_
                    001CH     0004H                  *** GAP ***
            BIT     0020H.0   0001H.1   UNIT         _BIT_GROUP_
                    0021H.1   0000H.7                *** GAP ***
            IDATA   0022H     0001H     UNIT         ?STACK

            * * * * * * *   C O D E   M E M O R Y   * * * * * * *
            CODE    0000H     0003H     ABSOLUTE
            CODE    0003H     035CH     UNIT         ?PR?PRINTF?PRINTF
            CODE    035FH     008EH     UNIT         ?C?LIB_CODE
            CODE    03EDH     0027H     UNIT         ?PR?PUTCHAR?PUTCHAR
            CODE    0414H     001BH     UNIT         ?PR?MAIN?HELLO
            CODE    042FH     000DH     UNIT         ?CO?HELLO
            CODE    043CH     000CH     UNIT         ?C_C51STARTUP

In this example, the last code segment begins at address 043Ch and is 000Ch bytes long. When you add these two numbers, you will get the total CODE memory that is used (which is 0448h).

Article last edited on: 2004-07-02 13:23:38

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential