I am creating scripting language. When I allocate thing ,it\'s allocate the thing and returns the address and then I do whatever with it and then delete it. I can\'t contro
Detecting whether memory no longer is alive could be done e.g. by maintaining a set of known dead pointer. Any pointer you create gets added to an alive set, and when you delete the object you move the pointer to the dead set.
The really tricky part will be reusing memory. What do you do when you want to reuse the same address for a different object? You can't tell by looking at the pointer, because the pointers look the same. So unless you never want to reuse memory, you'll have to change your requirements.