Added some more tests to darray unit and fixed memory leak