renamed deallocate() to clear() and made public
added tests for clear()