浏览代码

mention lazy reallocation

Samuel Thibault 5 年之前
父节点
当前提交
3f57bf96b0
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      doc/doxygen/chapters/310_data_management.doxy

+ 11 - 2
doc/doxygen/chapters/310_data_management.doxy

@@ -783,8 +783,17 @@ interface->size += increase;
 so that the allocated area has the expected properties and the allocation is accounted for properly.
 so that the allocated area has the expected properties and the allocation is accounted for properly.
 
 
 Depending on the interface (vector, CSR, etc.) you may have to fix several
 Depending on the interface (vector, CSR, etc.) you may have to fix several
-members of the data interface: e.g. both nx and allocsize for vectors, and store
-the pointer both in ptr and dev_handle.
+members of the data interface: e.g. both <c>nx</c> and <c>allocsize</c> for
+vectors, and store the pointer both in <c>ptr</c> and <c>dev_handle</c>.
+
+Some interfaces make a distinction between the actual number of elements
+stored in the data and the actually allocated buffer. For instance, the vector
+interface uses the <c>nx</c> field for the former, and the <c>allocsize</c> for
+the latter. This allows for lazy reallocation to avoid reallocating the buffer
+everytime to exactly match the actual number of elements. Computations and data
+transfers will use <c>nx</c> field, while allocation functions will use the
+<c>allocsize</c>. One just has to make sure that <c>allocsize</c> is always
+bigger or equal to <c>nx</c>.
 
 
 Important note: one can not change the size of a partitioned data.
 Important note: one can not change the size of a partitioned data.