From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id ED1D82C16 for ; Thu, 3 Aug 2017 10:29:12 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP; 03 Aug 2017 01:29:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,315,1498546800"; d="scan'208";a="132948608" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.221.5]) ([10.237.221.5]) by orsmga005.jf.intel.com with ESMTP; 03 Aug 2017 01:29:10 -0700 To: "Rohit Saini (Stellus)" , "'dev@dpdk.org'" References: <3d5197fb36ef4901907d785621f01da5@stellus.com> From: Sergio Gonzalez Monroy Message-ID: <2f989384-b5e8-f975-9a65-de5b4e3c0dd1@intel.com> Date: Thu, 3 Aug 2017 09:29:10 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <3d5197fb36ef4901907d785621f01da5@stellus.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] Use rte_malloc in application X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 08:29:13 -0000 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@dpdk.org] On Behalf Of Rohit Saini (Stellus) > Sent: Thursday, August 03, 2017 11:28 AM > To: 'dev@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