0

If RSS value of process(obtained from top or ps command) increases rapidly can it treated as memory leaks. Assume there is less provision to modify the code and no adequate support to install new utilities for tracking memory usage.

Since it is a proprietary application, i can't provide the code over here. I have narrow down the issue. Every openSSL connection open and close between client and server daemon was introducing some memory leaks. Server daemon is a typical server which keep on waiting for a connection, once connection is accepted it creates a thread to handle client request. openSSL1.0.1 is the version. As per link :https://stackoverflow.com/questions/29845527/how-to-properly-uninitialize-openssl

Following cleanup was added to server class destructor as i am interested in server side.

void ServerClass::doCleanUp()
{
    CRYPTO_cleanup_all_ex_data();
    ERR_free_strings();
    ERR_remove_state(0);
    ERR_remove_thread_state(NULL);
    CRYPTO_set_locking_callback(NULL);
    CRYPTO_set_id_callback(NULL);
}

After performing connection open and close test for different iterations there is some difference in RSS value, i.e (RSS_value_after_test_completion - RSS_value_at_startup) is positive. So this +ve difference can be treated as memory leaks ? Again as per the stackoverflow link there is concept of Application level cleanup and thread level cleanup. In my earlier solution i had used EVP_cleanup(), it created issues in other testcases, so same has been reverted. I can't perform Unload of DH param related activities since server should be always up. Am i missing anything ? Further guidance will be appreciated.

Some observations : Observation 1: When i perform open and close tests for 5, 10. 30 and 60 iterations, i observed once RSS value of the process reaches some value(37.7MB), it never increases from that value. NOTE:- Test iteration orders may not be same as mentioned.
Observation 2: With one iteration of open and close test, i could see RSS value increases around 7 MB. Observation 3: Testing person is performing test for a particular iterations say 100, so there is always a +ve difference for RSS value and claiming there is leak.

1 Answers1

0

Not necessarily:

  • your application might be maintaining an in-memory database which it periodically reviews and deletes obsolete items
  • the application might (for instance Java) periodically do garbage collection.

Even if it happens to run out of memory, it might be simply misconfigured (unable to reach the periodic review/cleanup state).

Thomas Dickey
  • 76,765