Possible Duplicate:
  Simple C implementation to track memory malloc/free?  




I need to know how much memory I have used till now in a C program and here is the pseudo code

#include &lt;stdio.h&gt;

int usedMemory =0;

void *MyMalloc(int size){
 usedMemory = usedMemory +size ;
 return malloc(size);
}

void MyFree(void *pointer){
/*****************what should i write here????*************/
}
int main(int argc, char *argv[])
{
    char *temp1= (char *)MyMalloc(100);
    char *temp2= (char *)MyMalloc(100);

    /*......other operations.........*/

    MyFree(temp1);
    MyFree(temp2);

    return 0;
}


Can anyone tell me what to write in the MyFree method(which decrements the amount of memory freed from usedMemory.


Question: Hadoop: JAVA_HOME is not set
Answer: Try to use short name to avoid a space in a path.

"C:\Program Files" should have short name C:\Progra~1 (you can verify it using DOS dir command or entering it into address bar in file explorer).

Set your JAVA_HOME this way:

export JAVA_HOME="/cygdrive/c/Progra~1/Java/jdk1.7.0_10"

Answered by user2540312