Template TMemory was added with tests. Some bugs with operator= were fixed.