BewareMyPower opened a new issue, #55:
URL: https://github.com/apache/pulsar-client-cpp/issues/55

   ### Search before asking
   
   - [X] I searched in the 
[issues](https://github.com/apache/pulsar-client-cpp/issues) and found nothing 
similar.
   
   
   ### Version
   
   - OS: Ubuntu 20.04
   - Pulsar: 2.10.1
   - C++ client: master 7f7653b
   
   ### Minimal reproduce step
   
   ```c++
   #include <pulsar/Client.h>
   #include <chrono>
   #include <thread>
   using namespace pulsar;
   
   int main() {
       Client client("pulsar://localhost:6650");
       while (true) {
           Producer producer;
           auto result = client.createProducer("my-topic", producer);
           if (result != ResultOk) {
               break;
           }
           producer.close();
           std::this_thread::sleep_for(std::chrono::milliseconds(500));
       }
       client.close();
   }
   ```
   
   ### What did you expect to see?
   
   The memory usage should be stable.
   
   ### What did you see instead?
   
   The program above just create producers in loop. However, the memory usage 
keeps increasing after some time (in my local env, after the 27th producer is 
created, each time a producer is created and closed, 16KB memory usage will be 
increased)
   
   Here is a simple script to detect memory usage on Linux (assuming the 
program name is `SampleProducer`):
   
   ```bash
   #!/bin/bash
   set -ex
   PROC_ID=$(ps aux | grep "SampleProducer" | grep -v grep | awk '{print $2}')
   if [[ $PROC_ID ]]; then
       for i in {1..100}; do
           cat /proc/$PROC_ID/status | grep VmData
           sleep 1
       done
   fi
   ```
   
![20221019155148](https://user-images.githubusercontent.com/18204803/196630177-9d00ee83-eb0f-4976-ab38-164d965fb139.jpg)
   
   
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to