[dpdk-dev] Use rte_malloc in application

Rohit Saini (Stellus) rohit.saini at stellus.com
Thu Aug 10 13:19:15 CEST 2017


Thanks Sergio. It helped. There was a mistake the way I was linking dpdk with my application.

Thanks,
Rohit

-----Original Message-----
From: Sergio Gonzalez Monroy [mailto:sergio.gonzalez.monroy at intel.com] 
Sent: Thursday, August 03, 2017 1:59 PM
To: Rohit Saini (Stellus) <rohit.saini at stellus.com>; 'dev at dpdk.org' <dev at dpdk.org>
Subject: Re: [dpdk-dev] Use rte_malloc in application

On 03/08/2017 07:12, Rohit Saini (Stellus) wrote:
> With below code, I am getting this warning.
>
> warning: cast to pointer from integer of different size 
> [-Wint-to-pointer-cast]
>
> my_node_t *data_ptr = (my_node_t *) rte_malloc(NULL, 
> sizeof(my_node_t), 0);

As far as I can see, the syntax looks correct.

How are you building/linking your application?

I would suggest to modify the DPDK examples/helloworld application to just do a simple rte_malloc as a first step.

Thanks,
Sergio


> Thanks,
> Rohit
>
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Rohit Saini 
> (Stellus)
> Sent: Thursday, August 03, 2017 11:28 AM
> To: 'dev at dpdk.org' <dev at dpdk.org>
> Subject: [dpdk-dev] Use rte_malloc in application
>
> Hi,
> I have a use case in my application where I need to implement my own memory manager, rather than doing malloc/free everytime to kernel.
> Instead of writing my own memory manager, I am thinking to use dpdk rte_malloc or rte_mempool. Please let me know if this is a good idea.
>
> Also,
>
> my_node_t *data_ptr = (my_node_t *) (uintptr_t) rte_malloc(NULL, 
> sizeof(my_node_t), 0);
>
> data_ptr is pointing to some invalid memory.  Am I doing anything wrong here?
>
>
> Thanks,
> Rohit




More information about the dev mailing list