Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call the libjuice library, call the library in cpp, the memory occupies 4M, call the library in pure C, the memory occupies 2.5M,Why? #187

Open
LiuAriel opened this issue Oct 28, 2022 · 2 comments

Comments

@LiuAriel
Copy link

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.

@paullouisageneau
Copy link
Owner

Isn't this issue a duplicate of #162 (comment) ?

I don't think that this is related to libjuice. You should use a proper tool like valgrind --tool=massif to profile the heap usage, as you can't really study the memory behavior of a program by only looking at VmRSS.

@LiuAriel
Copy link
Author

LiuAriel commented Oct 29, 2022

This problem is different from the previous issue. In fact, you can quickly load the libjuice library and run the above code, and it is very clear to check the memory changes separately. This is not a memory leak problem.

There is this question mainly because of the use of c libraries such as srtp and usrsctp, there will be no such problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants