[riot-notifications] [RIOT-OS/RIOT] Generic memory block allocator (#7651)

Tobias Heider notifications at github.com
Fri Feb 16 12:56:51 CET 2018


tobhe commented on this pull request.



> +/**
+ * @brief Memory pool
+ */
+typedef struct {
+    void *first_free; /**< head of the free list */
+} memarray_t;
+
+/**
+ * @brief Define static memory pool
+ *
+ * @param[out] name    name for defined memarray pool
+ * @param[in]  size    size of single memory chunk
+ * @param[in]  num     number of chunks in pool
+ */
+#define MEMARRAY(name, size, num)                                         \
+    static uint8_t _data_ ## name[num * size];                            \

> Why change from structure to size here ?

I'm not sure why i changed this in the first place. I think i will change it back.

> You silently expect size >= sizeof(void *), I would just allocate big enough cells all the time.
> By principle, I think its ok to allocate '8' length items even if requester asks for '5'.

agree, thanks for pointing this out

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/7651#discussion_r168738443
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20180216/caf7f722/attachment.html>


More information about the notifications mailing list