This memory savings in embedded devices is very important, why is the memory gap so large.
Write a cpp file, compile the library with gcc, and then use a C++ class to call libjuice, use When g++ compiles and runs, the memory is 4M. In the same situation, I just implement the C function interface call, and the g++ compile and run memory is only 2.5M. Of course, the C++ class is the simplest structure, and there is no other processing. It seems that as long as any interface of the libjuice library is called by the C++ class, Memory immediately 2M VmRSS
int main() { juice_set_log_level(JUICE_LOG_LEVEL_WARN); test_connectivity(); connectivity* conn = new connectivity(); conn->sendas(); while(true){ sleep(2); } return 0; }
The above codes are saved in .cpp and .c respectively, compiled and run, and it is very clear to view vmRSS.