Passing variable pointer as string to another function
There is not much to be reviewed here.

Function IsObject does it's job correctly and there is not much to be said there.

What would have to be reviewed is the real code that would need IsObject and memory management technique you have shown in your demo. Since your demo is just a demo it doesn't show real life issue you are trying to resolve, and therefore it is impossible to give you any tips and advice on how to improve it.

All I can say is don't ever manage memory like that, and if you really, really feel the need to do so, then post such code here for review. Unless you have some real corner case there, I am quite sure that such code can be thoroughly reviewed and refactored.

So, your code is perfectly fine except you should not be using it anywhere :)