>>7For static allocation only, it's an optimization problem in NP somewhere. For dynamic allocation it's impossible to optimize completely the general case. If you remove dependance on user input I'm not sure whether it's doable... it might be reducible to the halting problem.
Compacting (moving) collectors are pretty rad, yeah. Note: using one moves the allocation strategy
out of the general case, and into one that guarantees all pointers to allocated segments can be identified and therefore the segments can be moved. Normally the problem of identifying the pointers is halting equivalent (actually; it's worse without being able to further modify the program logic in other hard, possiby halting equivalent, ways) and can't be applied to the general dynamic case.