Keil Logo

dynamic memory

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Author
thibaud ravel
Posted
12-Apr-2018 10:25 GMT
Toolset
ARM
New! dynamic memory

hello, (NXP 1768 with RTX)
i will use dynamic memory (heap size : 0x5120=20768) in my project.
project allocate differente size in function of configuration.

i count the size allocate heap use = (size want + 4 byte pointer)

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.kui0099a/armlib_cihfiabf.htm

case 1:
at starting, sometimes malloc return null heap use (5246)
in this case want alloc less than case 2
allocate 1 struct1 size z
and allocate 1 struct2 size y (y<z) struct2 is less bytes than struct1.

case2:
but in other configuration can be alloc more than 5246, ex 10 000
allocate 5 x struct1 is ok

in this case 1, i use less byte, but it don't work.

can you explain this?

thanks

Author
Westonsupermare Pier
Posted
12-Apr-2018 16:22 GMT
Toolset
ARM
New! RE: dynamic memory

>>i count the size allocate heap use = (size want + 4 byte pointer)

Pretty sure the allocator has more overhead, and must be aligned.

Fragmentation and resource leaks can also diminish resources.

Unused/freed memory blocks will also continue to use resources especially when they can be folded into each other.

Author
thibaud ravel
Posted
13-Apr-2018 07:23 GMT
Toolset
ARM
New! RE: dynamic memory

l understand but it's very hight diference,

15k with alloc struct 5* struct1 and alloc 1 struct1 and 1 struct2, can't be alloc more 5k.

10k lost or alloc less than 5*struct1...

it's difficult to understand...

Author
thibaud ravel
Posted
13-Apr-2018 09:56 GMT
Toolset
ARM
New! RE: dynamic memory

at start no free.
higher pointer is 0x10007138 is case 1

in this case 2: higher is 0x10004520

can't alloc 32 bytes malloc return 0.

11K between two adress.

why he return NULL, heap is not full (for me), i can allocate at 0x10007138...

can you explain this?

is possible to have source code of malloc keil to understand?

Author
thibaud ravel
Posted
13-Apr-2018 09:59 GMT
Toolset
ARM
New! RE: dynamic memory

at start no free.
higher pointer is 0x10007138 is case 2

in this case 1: higher is 0x10004520

can't alloc 32 bytes malloc return 0.

11K between two adress.

why he return NULL, heap is not full (for me), i can allocate at 0x10007138...

can you explain this?

is possible to have source code of malloc keil to understand?

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.