Neural mechanisms of resource allocation in working memory