We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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)
infocenter.arm.com/.../index.jsp
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
>>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.
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...
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...
is possible to have source code of malloc keil to understand?
at start no free. higher pointer is 0x10007138 is case 2
in this case 1: higher is 0x10004520