Odd new() exception - K22F KDS

cancel
Showing results for 
Search instead for 
Did you mean: 

Odd new() exception - K22F KDS

452 Views
tharonhall
Contributor IV

I am getting a rather odd __cxa_throw() exception using operator new() using KDS and a K22F. I saw, odd, because it happens on only maybe the second invocation of new(), and there is PLENTY of room on the heap.

 

Using the representative code below:

 

class_ptr1 = new Class("Class 1");

class_ptr2 = new Class("Class 2");

 

class_ptr1 is assigned the address 0x20000020

 

When the attempt to allocate the second class fires, I get the __cxa_throw() exception. Of course, this would typically mean I am out of memory, but I have TONS of space left in the heap, unless i am reading this wrong somehow and the space is allocated top to bottom and not bottom to top:

 

.heap           0x20000000     0x8000

                0x20000000                . = ALIGN (0x8)

                0x20000000                __end__ = .

                0x20000000                PROVIDE (end, .)

                0x20000000                __HeapBase = .

                0x20008000                . = (. + HEAP_SIZE)

 

Anyone else seen this? This triggered after I changed my OSA from Bare Metal to FreeRTOS, so something funny may have happened there.

 

This has stopped me in my tracks, so any help GREATLY appreciated. Thanks!

Labels (1)
0 Kudos
2 Replies

277 Views
tharonhall
Contributor IV

So it appears that FreeRTOS didn't pull back into the code as cleanly as I had hoped. I did some clean up and the trap went away. Know I am having other issues with FreeRTOS, which I did not see before. It makes me suspicious that some more things are not set up correctly.

Will look at a clean FreeRTOS build for reference and see if I can't find something that is amiss.

0 Kudos

277 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Tharon,

Is good to hear that the problem with the __cxa_throw() exception was fixed, please let us know if you you run into any other problem.

Best Regards,

Carlos Mendoza

Technical Support Engineer

0 Kudos