int main(int argc, char *argv[]) { char *ret = setlocale(LC_ALL, NULL);
I tried both on Linux and OS X 10.10, on Linux I should not call it "free", but on OS X, if I do not call it "free", valgrind complains about a memory leak.
==62032== Memcheck, a memory error detector ==62032== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==62032== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info ==62032== Command: ./a.out ==62032==
So, on Linux, if I call "free," it will work. in OS X, if I don't call "free", it has a memory leak.
source share