cancel
Showing results for 
Search instead for 
Did you mean: 

not enough memory

anhhuy0701
Associate II
Posted on March 04, 2014 at 17:15

hello everyone, I have problem about memory

I download source code ''better string lib'' and I just add 3 C file to project, when I built no error happen, but I want to know exactly result then I debug, and program not complete, not enough memory for program. Although I increase the stack and heap size in startup_code file but nothing change

my project use keiluvision4 and st-link debugger

thank and regard!

#too-vauge
11 REPLIES 11
Posted on March 04, 2014 at 17:28

Ok, but what part are you using? How much memory is in that part? And how much is your project using for data/code? How much memory does the code dynamically allocate, and how large are the local/auto variable requirements?

Check the .MAP file

Are you using a code limited evaluation version of the compiler/debugger?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
chen
Associate II
Posted on March 04, 2014 at 17:31

Hi

You have probably run out of Flash space to store your program binary.

String libraries tend to be large.

anhhuy0701
Associate II
Posted on March 04, 2014 at 17:43

I know .MAP file but I have never check memory code dynamic allocate, I don't have experience to do like your advise, can you make it more clearly

STEP BY STEP if you have free time

chen
Associate II
Posted on March 04, 2014 at 18:24

'' when I built no error happen, but I want to know exactly result then I debug, and program not complete, not enough memory for program.''

''Are you using a code limited evaluation version of the compiler/debugger?''

First - are you using the code size limited version of Keil?

From your initial comments - it sounds like Keil has failed to compile/link binary because it has detected out of memory.

Can you post the exact error message?

''I don't have experience to do like your advise, can you make it more clearly

STEP BY STEP if you have free time''

If Keil has managed to compile and link, it will then update the map file.

If it has been updated - can you upload it?

Posted on March 04, 2014 at 19:45

For ones own algorithms you should be able to estimate dynamic memory usage and expectations.

In the more general sense one could instrument malloc()/free() utilization and generate metrics for size and frequency of usage, maximum total allocations, and life span, and track issues like fragmentation, leakage and multiple releases.

If you are unfamiliar with such things, you could try modelling the behaviour on PC based builds of the code, and with good approximations of the data being processed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
anhhuy0701
Associate II
Posted on March 05, 2014 at 03:27

I already done on PC and it's ok

just on micricontroller not enough memory

Posted on March 05, 2014 at 03:42

I already done on PC and it's ok, just on microcontroller not enough memory

If you had modelled it effectively you'd know how to quantify ''not enough''
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
troy1818
Senior
Posted on March 05, 2014 at 10:04

Hi huy.truong,

It is hard to really understand what kind of problem you have. If it works on PC it certainly does not need to work on MCU.

If this is a dynamic allocation problem:

Check all malloc() in the code and find out the number of bytes allocated in each call.

If this is a stack problem:

Take a look at all the functions and make sure that you are not allocating large number of bytes on the stack.

e.g.

char temp[100][10];

or

void function(temp[100][10])

etc.

If this is a problem with static code memory:

Check output file size.

Regards,

/rygelxvi

anhhuy0701
Associate II
Posted on March 05, 2014 at 16:32

hi rygelxvi

my project not use large number of byte on the stack, I use malloc to provide heap memory, I already increase Heap on startupcode file but nothing change