DSPRelated.com
Forums

A strange malloc() problem. HELP?

Started by ahma...@yahoo.com April 2, 2008
Hi;
1-In my program I have a function inside which I only using malloc() and an assert() functions. this function is called many times in the program and as I traced every time it allocates memory then the v-free() function will free memory. but in one case the function could not get memory and assert function aborts the program as I see this function gets only 10 words and all of the .sysmem memory is free. Could you tell me why and help me to trace it?

2- why in CCS the amount of variables are updated one or more steps after running their instruction line when I trace the code? is there any way to solve this like as is in visual C/C++ studio?

regards
Ahmad-

> 1-In my program I have a function inside which I only using malloc() and an
> assert() functions. this function is called many times in the program and
> as I traced every time it allocates memory then the v-free() function will
> free memory. but in one case the function could not get memory and assert
> function aborts the program as I see this function gets only 10 words and
> all of the .sysmem memory is free. Could you tell me why and help me to
> trace it?

One suggestion is to follow malloc into its source code and see why it fails. You
can get the C source for malloc from the matching .src file (search your CCS install
folder for *.src files). Once you know the C source you get some idea of what the
asm instructions are doing when you single-step into malloc.

> 2- why in CCS the amount of variables are updated one or more steps after
> running their instruction line when I trace the code? is there any way to
> solve this like as is in visual C/C++ studio?

I think the answer to #2 is pipeline... it takes a few cycles for operations to
actually take place ane memory / register results to appear.

-Jeff