3 ms·
It depends on the implementation of malloc. But usually yes, memory allocated at the same time is not at the same location. The solution is to allocate a big ch
by danybittel 5y ago
It depends on the implementation of malloc. But usually yes, memory allocated at the same time is not at the same location.
The solution is to allocate a big chunk at once and place your data in the order you want it. You can use, for example placement new for the objects and indices for references.
- Bambo 5y agoA problem with the chunk system is that i don't know how big a chunk is at the time it's declared?