This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[Bug Report] Memery Manager Library XXLARGE Blocks doesn't work

When I only used XXLARGE block, I got bellow error:

..\..\..\..\..\..\components\libraries\mem_manager\mem_manager.c(484): error:  #94-D: the size of an array must be greater than zero
  static uint32_t m_mem_pool[
LOCK_BITMAP_ARRAY_SIZE];                                                /**< Bitmap used for book-keeping availability of all blocks managed by the module.  */

After I checked mem_manager.c, I noticed LOCK_BITMAP_ARRAY_SIZE used TOTAL_BLOCK_COUNT. TOTAL_BLOCK_COUNT is defined as bellow in mem_manager.c:

#define TOTAL_BLOCK_COUNT (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT +                                     \
                           MEMORY_MANAGER_XSMALL_BLOCK_COUNT  +                                     \
                           MEMORY_MANAGER_SMALL_BLOCK_COUNT   +                                     \
                           MEMORY_MANAGER_MEDIUM_BLOCK_COUNT  +                                     \
                           MEMORY_MANAGER_LARGE_BLOCK_COUNT   +                                     \
                           MEMORY_MANAGER_XLARGE_BLOCK_COUNT  +                                     \
                           MEMORY_MANAGER_XLARGE_BLOCK_COUNT)

It will be zero when I only use XXLARGE blocks. I think the last line sure be "MEMORY_MANAGER_XXLARGE_BLOCK_COUNT)".

  • Hi,

    This is indeed a bug.

    /**@brief Total count of block managed by the module. */
    #define TOTAL_BLOCK_COUNT (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT +                                     \
                               MEMORY_MANAGER_XSMALL_BLOCK_COUNT  +                                     \
                               MEMORY_MANAGER_SMALL_BLOCK_COUNT   +                                     \
                               MEMORY_MANAGER_MEDIUM_BLOCK_COUNT  +                                     \
                               MEMORY_MANAGER_LARGE_BLOCK_COUNT   +                                     \
                               MEMORY_MANAGER_XLARGE_BLOCK_COUNT  +                                     \
                               MEMORY_MANAGER_XLARGE_BLOCK_COUNT)
    

    Should have been:

    /**@brief Total count of block managed by the module. */
    #define TOTAL_BLOCK_COUNT (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT +                                     \
                               MEMORY_MANAGER_XSMALL_BLOCK_COUNT  +                                     \
                               MEMORY_MANAGER_SMALL_BLOCK_COUNT   +                                     \
                               MEMORY_MANAGER_MEDIUM_BLOCK_COUNT  +                                     \
                               MEMORY_MANAGER_LARGE_BLOCK_COUNT   +                                     \
                               MEMORY_MANAGER_XLARGE_BLOCK_COUNT  +                                     \
                               MEMORY_MANAGER_XXLARGE_BLOCK_COUNT)
    

    I have created an internal bug report. Thanks for reporting.

Related