This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

printf and the heap ?

Hello,
I have integrated the following #pragma in my program

#pragma import(__use_no_heap)

now, if I dare using

printf

I get this linker error:

scheduler.axf: Error: L6915E: Library reports error: __use_no_heap was requested, but malloc was referenced
scheduler.axf: Error: L6915E: Library reports error: __use_no_heap was requested, but free was referenced

I thought that printf was not accessing the heap?

  • yes,,,,,

    you must be carful with printf, assume it has been for the duration and it uses memroy.

    to chek the meaning,,, expunge the pragma and look for the mapping file to be linked after

    you will seeing malloc in the printf??????

    goodbye my dear friend.

  • hello,
    thanks for your reply. well I did as you suggested.

    with printf in the code

        stdio.o(.text) refers to h1_alloc.o(.text) for malloc
        malloc.o(.text) refers to rt_heap_descriptor_intlibspace.o(.text) for __rt_heap_descriptor
        malloc.o(.text) refers (Special) to hguard.o(.text) for __heap_guard
        malloc.o(.text) refers (Special) to init_alloc.o(.text) for _init_alloc
        heap2.o(i._malloc_realtime) refers to rt_heap_descriptor_intlibspace.o(.text) for __rt_heap_descriptor
        heap2.o(i._malloc_realtime) refers to fdtree.o(i._FDTree_FindFirst) for _FDTree_FindFirst
        heap2.o(i._malloc_realtime) refers to init_alloc.o(.text) for __Heap_Full
        heap2.o(i._malloc_realtime) refers to fdtree.o(i._FDTree_RemoveNode) for _FDTree_RemoveNode
        heap2.o(i._malloc_realtime) refers to fdtree.o(i._FDTree_Insert) for _FDTree_Insert
        heap2.o(i._realloc_realtime) refers to h1_alloc.o(.text) for malloc
        heap2mt.o(i._malloc_realtime_concurrent) refers to rt_heap_descriptor_intlibspace.o(.text) for __rt_heap_descriptor
        heap2mt.o(i._malloc_realtime_concurrent) refers to fdtree.o(i._FDTree_FindFirst) for _FDTree_FindFirst
        heap2mt.o(i._malloc_realtime_concurrent) refers to init_alloc.o(.text) for __Heap_Full
        heap2mt.o(i._malloc_realtime_concurrent) refers to fdtree.o(i._FDTree_RemoveNode) for _FDTree_RemoveNode
        heap2mt.o(i._malloc_realtime_concurrent) refers to fdtree.o(i._FDTree_Insert) for _FDTree_Insert
        heap2mt.o(i._realloc_realtime_concurrent) refers to h1_alloc.o(.text) for malloc
        flsbuf.o(.text) refers to h1_alloc.o(.text) for malloc
        filbuf.o(.text) refers to h1_alloc.o(.text) for malloc
        ../../heapalloc.c                        0x00000000   Number         0  malloc.o ABSOLUTE
        malloc                                   0x00003d3d   Thumb Code   102  h1_alloc.o(.text)
    

    without printf - no reference to malloc!

  • sir,

    yes,,,, through your dilligence you have proof in conclusion that printf is useing malloc.

    you are congratulated and exhaulted.

    i am happy we answerered you situation with clarity and fortitude.

    goodbye my dear and beloved friend.

  • klappack matlerf,
    If you keep on answering my posts, I think I am going to have a very happy life! Let me wish you a happy and long life, a minimal numbers of bugs and a supportive management that is not obsessed with bonuses and stock options :)