[ 
https://issues.apache.org/jira/browse/PROTON-2140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16979593#comment-16979593
 ] 

ASF GitHub Bot commented on PROTON-2140:
----------------------------------------

astitcher commented on pull request #213: PROTON-2140: Lazy creation of various 
link related objects
URL: https://github.com/apache/qpid-proton/pull/213#discussion_r349282774
 
 

 ##########
 File path: c/src/core/codec.c
 ##########
 @@ -364,37 +364,72 @@ static int pn_data_inspect(void *obj, pn_string_t *dst)
 #define pn_data_hashcode NULL
 #define pn_data_compare NULL
 
-pn_data_t *pn_data(size_t capacity)
+pn_data_t *pni_data(size_t capacity, size_t initial_buffer)
 {
   static const pn_class_t clazz = PN_CLASS(pn_data);
   pn_data_t *data = (pn_data_t *) pn_class_new(&clazz, sizeof(pn_data_t));
   data->capacity = capacity;
   data->size = 0;
   data->nodes = capacity ? (pni_node_t *) malloc(capacity * 
sizeof(pni_node_t)) : NULL;
-  data->buf = pn_buffer(64);
+  data->buf = initial_buffer ? pn_buffer(initial_buffer) : NULL;
   data->parent = 0;
   data->current = 0;
   data->base_parent = 0;
   data->base_current = 0;
-  data->decoder = pn_decoder();
-  data->encoder = pn_encoder();
-  data->error = pn_error();
-  data->str = pn_string(NULL);
+  data->decoder = NULL;
+  data->encoder = NULL;
+  data->error = NULL;
+  data->str = NULL;
   return data;
 }
 
+pn_string_t *pni_data_str(pn_data_t *data)
+{
+  if (data->str == NULL) {
+    data->str = pn_string(NULL);
+  }
+  return data->str;
+}
+
+pn_decoder_t *pni_data_decoder(pn_data_t *data)
 
 Review comment:
   Ditto `static inline`
 
----------------------------------------------------------------
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:
us...@infra.apache.org


> proton-c has very high memory footprint for links
> -------------------------------------------------
>
>                 Key: PROTON-2140
>                 URL: https://issues.apache.org/jira/browse/PROTON-2140
>             Project: Qpid Proton
>          Issue Type: Improvement
>            Reporter: Gordon Sim
>            Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to