Memory-efficient C++ strings (interning, ropes, copy-on-write, etc) [closed]

copy-on-write (I think this comes for free in nearly all std::string implementations) I don’t believe this is the case any longer. Copy-on-write causes problems when you modify the strings through iterators: in particular, this either causes unwanted results (i.e. no copy, and both strings get modified) or an unnecessary overhead (since the iterators cannot be … Read more

/proc/[pid]/pagemaps and /proc/[pid]/maps | linux

F**/proc/<pid>/pagemap + /proc/<pid>/maps dump example program** Here is a pagemap example that converts virtual addresses to physical: Is there any API for determining the physical address from virtual address in Linux? The following program uses both /proc/<pid>/pagemap + /proc/<pid>/maps to dump page table information to show how they can be used together. Usage: sudo ./pagemap_dump.out … Read more

CPython memory allocation

Much of this is answered in the Memory Management chapter of the C API documentation. Some of the documentation is vaguer than you’re asking for. For further details, you’d have to turn to the source code. And nobody’s going to be willing to do that unless you pick a specific version. (At least 2.7.5, pre-2.7.6, … Read more

Whats up with static memory in java?

Imports don’t correlate with any instructions in compiled code. They establish aliases for use at compile time only. There are some reflective methods that allow the class to be loaded but not yet initialized, but in most cases, you can assume that whenever a class is referenced, it has been initialized. Static member initializers and … Read more