You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2019/06/21 14:10:18 UTC

[GitHub] [qpid-dispatch] astitcher commented on a change in pull request #525: DISPATCH-1372 alloc_pool intrusive linked list can be replaced by a linked stack

astitcher commented on a change in pull request #525: DISPATCH-1372 alloc_pool intrusive linked list can be replaced by a linked stack
URL: https://github.com/apache/qpid-dispatch/pull/525#discussion_r296252051
 
 

 ##########
 File path: src/alloc_pool.c
 ##########
 @@ -44,20 +46,97 @@ DEQ_DECLARE(qd_alloc_type_t, qd_alloc_type_list_t);
 #define PATTERN_BACK  0xbabecafe
 
 struct qd_alloc_item_t {
-    DEQ_LINKS(qd_alloc_item_t);
     uint32_t              sequence;
 #ifdef QD_MEMORY_DEBUG
     qd_alloc_type_desc_t *desc;
     uint32_t              header;
 #endif
 };
 
-DEQ_DECLARE(qd_alloc_item_t, qd_alloc_item_list_t);
+#define CHUNK_SIZE 128/sizeof(void*)
 
+struct qd_alloc_chunk_t {
+    qd_alloc_chunk_t     *prev;
+    qd_alloc_item_t      *items[CHUNK_SIZE];
+    qd_alloc_chunk_t     *next;
+};
+
+struct qd_alloc_linked_stack_t {
+    //the base
+    qd_alloc_chunk_t     *top_chunk;
+    uint32_t              top;          //qd_alloc_item* top_item = top_chunk->items[top+1] <-> top > 0
 
 Review comment:
   Probably want to reorder `top` and `size`. On 64 bit machine there would be 32 bits of padding in the middle of the struct with this ordering.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org