<div>Hi,</div><div><br></div><div>I m working with pretty large vtkPolyData on a x64 machine</div><div>(more than 201 326 592 points, vtk 5.6.1)</div><div><br></div><div>When i try to add a new point (201 326 593th) with InsertNextPoint it calls the </div>
<div>vtkDataArrayTemplate<>::ResizeAndExtend and</div><div>tries to allocate 402 653 181 points, which is just impossible.</div><div>(allocation of floats, 3 floats per point)</div><div><br></div><div>I understand that for small arrays it is good to allocate each time 'double' the memory</div>
<div>when resizing an array but when we reach very large dataset, it seems a little bit too much, isn'it ?</div><div><br></div><div>Do you plan to modify that ? </div><div><br></div><div>Thanks a lot!</div><div>Benoit</div>
<div><br></div><div>PS: i extracted the code of vtkDataArrayTemplate :</div><div><br></div><div>------------------------------- CODE of vtkDataArrayTemplate -------------------------------</div><div><br></div><div>template <class T>T* vtkDataArrayTemplate<T>::ResizeAndExtend(vtkIdType sz)</div>
<div>{</div><div> T* newArray;</div><div> vtkIdType newSize;</div><div><br></div><div> if(sz > this->Size) </div><div> {</div><div> // Requested size is bigger than current size. Allocate enough</div><div>
// memory to fit the requested size and be more than double the</div><div> // currently allocated memory.</div><div> newSize = this->Size + sz; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< SEE HERE</div>
<div> }</div><div> else if (sz == this->Size)</div><div> {</div><div> // Requested size is equal to current size. Do nothing.</div><div> return this->Array;</div><div> }</div><div> else</div><div>
{</div>
<div> // Requested size is smaller than current size. Squeeze the</div><div> // memory.</div><div> newSize = sz;</div><div> this->DataChanged();</div><div> }</div><div><br></div><div> // Wipe out the array completely if new size is zero.</div>
<div> if(newSize <= 0)</div><div> {</div><div> this->Initialize();</div><div> return 0;</div><div> }</div>