|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
D - how dynamic arrays work?
I wonder how dynamic arrays are implemented in D. Do they reallocate themselves each time new element is added? Or do they reserve memory in larger blocks, so that several (how many?) consequent appends would not require reallocation, like std::vector does? I understand that it's implementation-defined, still it would be useful to know at least how your compiler works; I just want to decide if I can use dynamic arrays to generate data dynamically in the memory as is fast enough, or I have to make a wrapper class that'd allocate memory in larger blokes. Dec 21 2001
Pavel Minayev wrote:I wonder how dynamic arrays are implemented in D. Do they reallocate themselves each time new element is added? Or do they reserve memory in larger blocks, so that several (how many?) consequent appends would not require reallocation, like std::vector does? I understand that it's implementation-defined, still it would be useful to know at least how your compiler works; I just want to decide if I can use dynamic arrays to generate data dynamically in the memory as is fast enough, or I have to make a wrapper class that'd allocate memory in larger blokes. Dec 21 2001
|