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

Memory leak on demo asio_httpd #8

Closed
mingodad opened this issue Jan 28, 2016 · 8 comments
Closed

Memory leak on demo asio_httpd #8

mingodad opened this issue Jan 28, 2016 · 8 comments

Comments

@mingodad
Copy link

Hello !
I just cloned tbox and build it, then when testing ./demo asio_httpd with httpress/ab and watching a task manager I can see how memory consumption only grows, keep running the command bellow and watch process memory usage:

ab -n 100000 -c 2000 -k http://127.0.0.1:8080/tbox/config.h

or

httpress -t 2 -n 100000 -c 2000 -k http://127.0.0.1:8080/tbox/config.h

I tested with valgrind and it reports no memory leaks (same number of allocations/deallocations) when terminating the program normally (key press), so I think it's memory fragmentation or any pool attached to a connection that is not been released (but because maybe they are attached to a hierarchy of pools that are released at the end valgrind can not find anything).

The system where it's running is a ubuntu 14.04 64bits.

Cheers !

@mingodad
Copy link
Author

Running this command the program starts with 20MB and when served 5,000,000 requests it's using around 180MB and continue growing but I stopped the program.

echo 1 > 1.txt
./demo asio_httpd

on other console:
httpress -t 2 -n 10000000 -c 2000 -k http://127.0.0.1:8080/1.tx

Cheers !

@mingodad
Copy link
Author

Also trying requesting a non existing file is faster to see the memory growing:

httpress -t 2 -n 10000000 -c 2000 -k http://127.0.0.1:8080/xxx.tx

@mingodad
Copy link
Author

I also tried with other parameters at demo.c:
if (!tb_init(tb_null, tb_native_allocator())) return 0;
if (!tb_init(tb_null, tb_static_allocator((tb_byte_t*)malloc(300 * 1024 * 1024), 300 * 1024 * 1024))) return 0;

But the same memory consumption pattern happen.

Cheers !

@foobar
Copy link

foobar commented Jan 29, 2016

can you be more specific on the memory usage? Was it virtual space or RSS?

@mingodad
Copy link
Author

Hello !
It's RSS .
Couldn't you reproduce it with the same/similar load test ?

Cheers !

@waruqi
Copy link
Member

waruqi commented Jan 29, 2016

I will try to fix this problem.

Thanks!

@waruqi
Copy link
Member

waruqi commented Jan 31, 2016

Hi!

I have fixed this memory issue with commits: 79f496a and a6d6b1f

Thanks!

@mingodad
Copy link
Author

Not at all !
Thank you for this great work !

@waruqi waruqi closed this as completed Jan 31, 2016
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

3 participants