rename MemoryStruct.size to MemoryStruct.used
rename MemoryStruct.realsize to MemoryStruct.allocated
rename realsize to data_size
reuse variable containing new allocation size