1. A method for managing memory in a system, said system including a plurality of software entities that each access the memory and having a non-uniform memory access architecture (NUMA) with a plurality of nodes, the method comprising: selecting a sample set of memory units; invalidating the sample set of memory units and detecting accesses by any of the software entities to the invalidated memory units; computing a metric as a function of a proportion of accessed memory units relative to the sample set of memory units; and associating at least one of the software entities with one of the nodes based at least in part on the corresponding metric so as to increase memory locality of the associated software entity.