<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Memory leak when i call FLEXCAN_DRV_Init to initialize the can controller in S32K</title>
    <link>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743346#M2018</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ana.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe we can add a judgement when creating the semaphore. If the semaphore is created, we can ignore the following creating process.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;status_t FLEXCAN_DRV_Init(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; uint8_t instance,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; flexcan_state_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; flexcan_user_config_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;data)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt; for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (i &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; FEATURE_CAN_MAX_MB_NUM; i&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (state-&amp;gt;mbSema_created &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;==&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;False&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; osifStat &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; OSIF_SemaCreate((semaphore_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state-&amp;gt;mbs[i].mbSema, &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0U&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (osifStat &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; STATUS_SUCCESS)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (j &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; j &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; i; j&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)OSIF_SemaDestroy((semaphore_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state-&amp;gt;mbs[j].mbSema);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; STATUS_ERROR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; state-&amp;gt;mbs[i].isBlocking &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; state-&amp;gt;mbs[i].mb_message &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;NULL&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; state-&amp;gt;mbs[i].state &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; FLEXCAN_MB_IDLE;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; state-&amp;gt;mbSema_created &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;True&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;status_t FLEXCAN_DRV_Deinit(uint8_t instance)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;if(state-&amp;gt;mbSema_created == True)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt; for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (i &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; FEATURE_CAN_MAX_MB_NUM; i&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; osifStat &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; OSIF_SemaDestroy((semaphore_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state-&amp;gt;mbs[i].mbSema);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (osifStat &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; STATUS_SUCCESS)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; result &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; STATUS_ERROR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state-&amp;gt;mbSema_created &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;False&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Apr 2018 08:15:49 GMT</pubDate>
    <dc:creator>cheney</dc:creator>
    <dc:date>2018-04-03T08:15:49Z</dc:date>
    <item>
      <title>Memory leak when i call FLEXCAN_DRV_Init to initialize the can controller</title>
      <link>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743341#M2013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, When i use the can driver, i found that if there's no protect in the creation of semaphore.&lt;/P&gt;&lt;P&gt;When the CAN bus enter busoff state, i use FLEXCAN_DRV_Init to initialize the can controller. But when FLEXCAN_DRV_Init is called, it will call OSIF_SemaCreate((semaphore_t *const)&amp;amp;state-&amp;gt;mbs[i].mbSema, 0U)&amp;nbsp; to create the semaphore, no matter the semaphore is created or not.&lt;/P&gt;&lt;P&gt;So what should i do in this case?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2018 08:26:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743341#M2013</guid>
      <dc:creator>cheney</dc:creator>
      <dc:date>2018-03-28T08:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak when i call FLEXCAN_DRV_Init to initialize the can controller</title>
      <link>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743342#M2014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, On which platform did you observed this behavior, the release version you used&amp;nbsp; ?&lt;/P&gt;&lt;P&gt;Did you run as baremetal or FreeRTOS, OSIF has different behavior ?&lt;/P&gt;&lt;P&gt;In case of bare metal :&lt;/P&gt;&lt;P&gt;The semaphores space should&amp;nbsp; already be allocated before you call&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;FLEXCAN_DRV_Init in the&amp;nbsp;flexcan_state_t&amp;nbsp; structure that is passed to the init function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;In the driver init function the semaphore is only enabled(initialized) by &lt;SPAN&gt;OSIF_SemaCreate((semaphore_t *const)&amp;amp;state-&amp;gt;mbs[i].mbSema, 0U);&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 13:11:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743342#M2014</guid>
      <dc:creator>alexandrunan</dc:creator>
      <dc:date>2018-04-02T13:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak when i call FLEXCAN_DRV_Init to initialize the can controller</title>
      <link>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743343#M2015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Alexandru, thank you for you reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The development enviroment is showed below:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MCU:&lt;/STRONG&gt;S32k144&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IDE&lt;/STRONG&gt;:S32DS v2&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SDK&lt;/STRONG&gt;:0.8.4&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FreeRTOS&lt;/STRONG&gt;: Used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because the rtos is used, the OSIF_SemaCreate() is ported to RTOS API xSemaphoreCreateCounting().&amp;nbsp; Whenever i call &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;FLEXCAN_DRV_Init&lt;/SPAN&gt;, it will call &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&lt;SPAN&gt;OSIF_SemaCreate((semaphore_t *const)&amp;amp;state-&amp;gt;mbs[i].mbSema, 0U)&lt;/SPAN&gt;&lt;/SPAN&gt; to create the semaphore and it will consume the memory size from the freertos heap.This will cause the memory leak.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2018 01:01:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743343#M2015</guid>
      <dc:creator>cheney</dc:creator>
      <dc:date>2018-04-03T01:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak when i call FLEXCAN_DRV_Init to initialize the can controller</title>
      <link>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743344#M2016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case, if the driver fails to initialize, return code&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;FLEXCAN_DRV_Init is different from STATUS_SUCCESS, you can call&amp;nbsp;FLEXCAN_DRV_Deinit that will destroy the already allocated Semaphores. In this case you can avoid&amp;nbsp;excessive allocations.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2018 05:43:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743344#M2016</guid>
      <dc:creator>alexandrunan</dc:creator>
      <dc:date>2018-04-03T05:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak when i call FLEXCAN_DRV_Init to initialize the can controller</title>
      <link>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743345#M2017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All semaphores used by FlexCAN are destroyed when calling FLEXCAN_DRV_Deinit. There should not be two subsequent calls of FLEXCAN_DRV_Init without calling FLEXCAN_DRV_Deinit in the mean time. Though, the driver should report an error status if FLEXCAN_DRV_Init is called twice. We will investigate this scenario and thank you for reporting this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2018 07:13:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743345#M2017</guid>
      <dc:creator>AnaAldescu</dc:creator>
      <dc:date>2018-04-03T07:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Memory leak when i call FLEXCAN_DRV_Init to initialize the can controller</title>
      <link>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743346#M2018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Ana.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe we can add a judgement when creating the semaphore. If the semaphore is created, we can ignore the following creating process.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;status_t FLEXCAN_DRV_Init(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; uint8_t instance,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; flexcan_state_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; flexcan_user_config_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;data)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt; for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (i &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; FEATURE_CAN_MAX_MB_NUM; i&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (state-&amp;gt;mbSema_created &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;==&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;False&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; osifStat &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; OSIF_SemaCreate((semaphore_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state-&amp;gt;mbs[i].mbSema, &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0U&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (osifStat &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; STATUS_SUCCESS)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (j &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; j &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; i; j&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)OSIF_SemaDestroy((semaphore_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state-&amp;gt;mbs[j].mbSema);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; STATUS_ERROR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; state-&amp;gt;mbs[i].isBlocking &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; state-&amp;gt;mbs[i].mb_message &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;NULL&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; state-&amp;gt;mbs[i].state &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; FLEXCAN_MB_IDLE;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; state-&amp;gt;mbSema_created &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;True&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;status_t FLEXCAN_DRV_Deinit(uint8_t instance)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;if(state-&amp;gt;mbSema_created == True)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt; for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (i &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; FEATURE_CAN_MAX_MB_NUM; i&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; osifStat &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; OSIF_SemaDestroy((semaphore_t &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state-&amp;gt;mbs[i].mbSema);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (osifStat &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; STATUS_SUCCESS)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; result &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; STATUS_ERROR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;}&lt;/DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;state-&amp;gt;mbSema_created &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;False&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2018 08:15:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/Memory-leak-when-i-call-FLEXCAN-DRV-Init-to-initialize-the-can/m-p/743346#M2018</guid>
      <dc:creator>cheney</dc:creator>
      <dc:date>2018-04-03T08:15:49Z</dc:date>
    </item>
  </channel>
</rss>

