cleanup ptr free

- add delete allocated ptr
- use __delete() to free allocated memory
change code formatting
rebase and change code formating
Merge pull request #443 from psychocoderHPC/topic-cleanUpMemoryPtrFrees

Fix #267 Cleanup memory ptr frees