Closed rhubarbdog closed 11 months ago
It looks like free memory is used up in chunks. Try creating many strings and average the free memory reduction.
Memory is allocated in chunks of 16 bytes. And the bytearray needs an outer object and an inner array to hold the data, so it takes: 16 + 112 = 128 bytes.
For the string, they way you've written it the program will create both the "123...890" * 5
string (length 100) and the final string of length 102. That's at least 256 bytes.
In summary: this is expected.
i have the following program looking at memory usage, why does an array of ascii characters take up 264 bytes and a 102 byte
bytearray
take 128 bytes?and get results