From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f196.google.com (mail-yw0-f196.google.com [209.85.161.196]) by dpdk.org (Postfix) with ESMTP id 28F3D2BC9 for ; Thu, 3 Aug 2017 15:29:46 +0200 (CEST) Received: by mail-yw0-f196.google.com with SMTP id s143so802599ywg.4 for ; Thu, 03 Aug 2017 06:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5c7g9gxjMZIP6DJ0VlxmJ99iJtCd3s5Ys1gspqHyOF8=; b=YJI7xk3+VUZUppmtn9jsrZNvqdLSNcbsv5b1kHGOYKAMIqL0FTBkxHJRRifsN9tphV jdyqsVo4nRco2NB4RWlHYYMQDlg2tENStXV7p7iPBt7YBHvjrvJnp49DLlPTmnmthUnK llJ9oqwYOWrzh413ZQcU0bsPFn8uXDlhGBZEGUqfp1X/K6cZdiHAQNzmd9GF+zK5wT7L Tm5bcMVjBAZFufhVMnpBo4GS+auuCtlAOns7cEDvieH0z4nvMO5c+MEpAdImJabQatyz 2tdJFB0kn9kwfJLLF4FLomhhzL0GrgiTP3TFj0I+wacK7MUP3V3DGWVad6J4YdaBU5EI RTAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5c7g9gxjMZIP6DJ0VlxmJ99iJtCd3s5Ys1gspqHyOF8=; b=B7fiHrTlqnK7uaqgHyA2MTFrVX9PAzP/H/cvo3hlHsj51VZvgKfXHSZJg7XJgZW4P+ JT0lAm3WPOHTFT8RLqoHuDdOzyS4PIkztOiLuaJtfnU5tT3jb6tSOZVRLL+7iPKjXRJI qLaObq6KiAC3JrkEA0RxXGkd82mFlxSQ1TPmmd3wyq0Z0hUHQhskyA0C5U04jwsg8D2z OTwsKIF2UNttU0eO97XhevJsSmuMcMPKgjFL/rpDjKcQxWRjibNI8K2psiUFx4ytuA8M uLsAT0Qx9mflT8EsFjQoUYaDrjQKImALL3N8pHYABWsn/OuYu1xawm62FTRr+h9Eoavo 26/Q== X-Gm-Message-State: AIVw110pDJ3B+a4WpyueWbqijlzQufmHs33FowCdDsVokYutiQ/AWM9U EDnK+ZSJ2tFfwkEyicEJuNA6iamM9g== X-Received: by 10.37.189.70 with SMTP id p6mr1267153ybm.178.1501766985365; Thu, 03 Aug 2017 06:29:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.197.14 with HTTP; Thu, 3 Aug 2017 06:29:44 -0700 (PDT) In-Reply-To: <3d5197fb36ef4901907d785621f01da5@stellus.com> References: <3d5197fb36ef4901907d785621f01da5@stellus.com> From: Stefan Puiu Date: Thu, 3 Aug 2017 16:29:44 +0300 Message-ID: To: "Rohit Saini (Stellus)" Cc: "dev@dpdk.org" Content-Type: text/plain; charset="UTF-8" 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 13:29:46 -0000 Hi, This is not strictly DPDK-related, but still... On Thu, Aug 3, 2017 at 9:12 AM, 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); I think the warning concerns the first argument passed to rte_malloc. NULL probably expands to 0 (at least that seems to happen in C++), so it gets treated as an int instead of a pointer. In C++11, there's nullptr for this; or you could simply use a non-NULL string. HTH, Stefan. > > 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