using a dynamic max mem