You are right about the fact that it is an issue for long-running 32-bit programs. It may be possible to improve the situation by adhering to the following rules throughout your program:
- avoid struct types which contain both integer and pointer fields
- avoid struct types containing arrays such as [100]byte (replace it with *[100]byte or with []byte)
- avoid data structures which form densely interconnected graphs at run-time
- avoid deep call chains at run-time
- replace pointer identity with value equivalence (this can lead to a more explicit memory management in your program)
- if a data structure contains both long-lived and short-lived fields, move the short-lived fields into a separate data structure or into local variables of a function
- avoid integer values which may alias at run-time to an address; make sure most integer values are fairly low (such as: below 10000)
- if you are using caches to speed up your program, apply the rules mentioned here to redesign the cache. It may also help to use strings instead of structs as map keys.
- lower the overall memory consumption of your program
- carefully speed up your program (this may lead to a lower memory consumption in certain situations)