added test for dynamic memory