×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Memory leak in emulator using libcrypto

    I've tried to send this to opencfeedback@s60.com but my email bounced. So here it is:

    I have recently spent several hours tracking down a memory leak in my emulator build. It turns out that if I just do:

    RSA *rsa;
    rsa = RSA_new();
    RSA_free( rsa );

    then I get a memory leak in the emulator, but not on debug or release builds for the device. Is there some clean-up function to call in the emulator after using libcrypto or is this just a bug?

    P.S. I am also using libc and the call to close the stdlib in my destructor - this doesn't cause any problems on its own.

  2. #2
    (Retired) Nokia Developer Admin.
    Join Date
    Jan 2006
    Location
    Michigan
    Posts
    4,664

    Re: Memory leak in emulator using libcrypto

    I'll pass this on

    Ron

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    4

    Re: Memory leak in emulator using libcrypto

    The application using libcrypto needs to call the API "CRYPTO_cleanup_all_ex_data" before it exits.
    This does some cleanup and will not cause memory leaks.

    So the sequence would be :

    RSA *rsa;
    rsa = RSA_new();
    RSA_free(rsa);
    CRYPTO_cleanup_all_ex_data();

    This cleanup call is not only on emulator its genric one and should be called in all cases (emulator/hardware).

    Also, other cleanup routines are needed if the corresponding modules are used (for example ERR)

    CONF_modules_unload(1); //for conf
    EVP_cleanup(); //For EVP
    ENGINE_cleanup(); //for engine
    CRYPTO_cleanup_all_ex_data(); //generic
    ERR_remove_state(0); //for ERR
    ERR_free_strings(); //for ERR

  4. #4
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Memory leak in emulator using libcrypto

    This works perfectly, thanks. I didn't see this in the documentation anywhere? Sorry if I missed it. If not perhaps it could go in the next release.

    Sorcery

Similar Threads

  1. memory leak on emulator = memory leak on device
    By manmli in forum Mobile Java General
    Replies: 2
    Last Post: 2006-08-05, 19:54
  2. Memory Leak After Leave
    By gowthamyemme in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-02-23, 19:35
  3. Replies: 0
    Last Post: 2006-02-20, 11:51
  4. severe memory leak when using CSendAppUi ( Nokia 7650 )
    By ejurinsky in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2002-12-05, 10:13
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×