templates and heap