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

memory allocation with new operator and program not working

I'm using Real View C++ compiler and I want to use dynamic creation of object.

This code works fine:

  CSomeObject * p_obj;

  CSomeObject obj;
  p_obj = &obj;

but this not:

  CSomeObject * p_obj = new CSomeObject;

I don't know why.
Can anybody help me how to solve this problem?
I need second solution.

Parents
  • I'm new to ARM.
    How to define heap?

    Is it enough to change Heap_Size in Startup file?
    (I'm using LPC2148 microcontroler)

    ;// <h> Heap Configuration
    ;//   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF>
    ;// </h>
    
    Heap_Size       EQU     0x00001000
    
                    AREA    HEAP, NOINIT, READWRITE, ALIGN=3
    __heap_base
    Heap_Mem        SPACE   Heap_Size
    __heap_limit
    

Reply
  • I'm new to ARM.
    How to define heap?

    Is it enough to change Heap_Size in Startup file?
    (I'm using LPC2148 microcontroler)

    ;// <h> Heap Configuration
    ;//   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF>
    ;// </h>
    
    Heap_Size       EQU     0x00001000
    
                    AREA    HEAP, NOINIT, READWRITE, ALIGN=3
    __heap_base
    Heap_Mem        SPACE   Heap_Size
    __heap_limit
    

Children