52235 malloc problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,237件の閲覧回数
Balcer
Contributor II

Since 5223x chips have small RAM I should expect it fills up some day. But not so quickly. My CW7.2 shows project's (depends on settings) code size from 5 to 8kB. Data size about 1.5kB. Now at runtime I allocate memory for few structures. After allocating about 800 bytes I get errno: 12 and no allocation at all. I thought I have 32 kB of RAM at hand... It's quite odd that setting different optimization I get from 5 to 8 kB of code but no difference in malloc behavior. What is going on? Any ideas? 

 

Running CW7.2SE, RAM configuration, EWL C.

 

 

TIA,

Michal

ラベル(1)
0 件の賞賛
返信
1 解決策
673件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

One issue was in the past (saw last mails years ago, I don't know about the 7.2 setup) that memory pools were used.

Search in old threads, for example

https://community.freescale.com/message/43154#43154

 

Another thing to check is how your lcf is setup, maybe you just do not allocate more RAM for the heap?


Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
673件の閲覧回数
Balcer
Contributor II

SOLVED!

I've changed ___heap_size   in the .lcf file to 0x800 and it helped.

 

Thanks a lot for quick response.

0 件の賞賛
返信
673件の閲覧回数
TomE
Specialist II

See if CW provides (or can be made to provide) a MAP file. Examine that to see how the memory is allocated.

 

Memory is usually taken up with (in order) the Interrupt Vectors, Code, Data, BSS, Heap and Stack.

 

The "heap" is what Malloc uses. It and the Stack usually share all the remaining memory. Somewhere in the project you have to tell CW how much to allocate for the Stack, with the remaining usually being for the Heap. If your Stack is too big (or somehow the project is set for no heap) then that might explain your problem.

 

0 件の賞賛
返信
674件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

One issue was in the past (saw last mails years ago, I don't know about the 7.2 setup) that memory pools were used.

Search in old threads, for example

https://community.freescale.com/message/43154#43154

 

Another thing to check is how your lcf is setup, maybe you just do not allocate more RAM for the heap?


Daniel

0 件の賞賛
返信