Merge pull request #3401 from BrzVlad/fix-managed-alloc2