Python list memory reallocation issue -
if using c-python or jython (in python 2.7), , list
([]
) data structure, if continue add new elements, there memory reallocation issue how java arraylist have (since java arraylist requires continuous memory space, if current pre-allocated space full, needs re-allocate new larger continuous large memory space, , move existing elements new allocated space)?
regards, lin
internally python lists array of pointers mentioned hpaulj
the next question how can extend array in c explained in answer. explains can done using realloc
function in c.
this lead me in behavior of realloc mentions
the function may move memory block new location (whose address returned function).
from understanding array object extended if contiguous memory available, else memory block (containing array object not list object) copied newly allocated memory block greater size.
this understanding, corrections welcome if wrong.
Comments
Post a Comment