malloc system calls fail in S32 Design Studio

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

malloc system calls fail in S32 Design Studio

1,085 Views
mrajanna
Contributor V

Hi,

I am unable to make malloc calls in the code. Can you please check it?

*************************************************

struct node   

{

    char data[5];

    struct node *next;

}*head;

 

struct node *nptr;

nptr = malloc(sizeof(struct node));

 

*************************************************

When I move mouse tooltip on nptr in above code, I see below warning.

 

/*******************

Multiple errors reported.

 

1) Failed to execute MI command:

-var-create - * nptr

Error message from debugger back end:

value has been optimized out

 

2) Unable to create variable object

 

3) Failed to execute MI command:

-var-create - * nptr

Error message from debugger back end:

value has been optimized out

*******************/

Thanks

Mohan

Tags (1)
2 Replies

832 Views
jiri_kral
NXP Employee
NXP Employee

Hi Mohan, 

it is some error with PE Micro debugging. Try to restart S32DS. Did you also include <stdlib.h> header ?

Anyway - usage dynamically allocated memory in embedded systems - and especially in automotive industry - is not good practice. 

Jiri

0 Kudos

832 Views
martin_kovar
NXP Employee
NXP Employee

Hello Mohan,

which version of S32 Design Studio you use and which architecture (Power Architecture, ARM...)?

Could you please share the whole example?

Regards,

Martin