I am trying to measure an API using Google Benchmark. It deals with the client/server code. The Google Benchmark application, runs the setUp() TearDown() pairs several times to measure the timing in an appropriate way. The client/server works over TCP Transport.
Problem: Within a single process (Google Benchmark) the client is restarted many number of times. This causes remnant anonymous inodes existing and as a result, I get an error
epoll: too many files open
When I try lsof | grep "a_inode", I see that all the anonymous inodes created by eventfd/eventpoll/filefd exist in opened state.
COMMAND PID TID USER FD TYPE DEVICE SIZE/OFF NODE NAME
gbench 6514 6517 boarnerges 1020u a_inode 0,13 0 9567 [eventfd]
gbench 6514 6517 boarnerges 1021u a_inode 0,13 0 9567 [eventpoll]
gbench 6514 6517 boarnerges 1022u a_inode 0,13 0 9567 [timerfd]
gbench 6514 6520 boarnerges cwd DIR 8,1 4096 543203 /home/boarnerges/project_GoogleBenchmark/build
gbench 6514 6520 boarnerges rtd DIR 8,1 4096 2 /
gbench 6514 6520 boarnerges txt REG 8,1 2494784 949699 /home/boarnerges/project_GoogleBenchmark/build/tests/tests/GBenchmarkTests/benchmark_client/it_gbenchmark_client
How do I solve this problem? Can the anonymous inodes be released from within the process?