free memory not clears the memory block
I am using DllImport to call method in c wrapper library from my own .net class. This method in c dll creates a string variable and returns the pointer of the string. Something like this; _declspec(dllexport) int ReturnString() { char* retval = (char *) malloc(125); strcat(retval, "SOMETEXT"); strcat(retval, "SOMETEXT MORE"); return (int)retval; } Then i read the string using Marshall.PtrToStringAnsi(ptr). After i get a copy of the string, i simply call another c method HeapDestroy which is in c wrapper library that calls free(ptr). Here is the question; Recently while it is working like a