Memory leak issue with casablanca library. RRS feed

  • Question

  • Hi All,

     I am trying to download azure storage blob using casablanca library. Below is the  code -

    azure::storage::cloud_blob_client blob_client(blob_uri, store_cred);

    azure::storage::cloud_blob_container container = get_blob_container(blob_client,U("mytest"), true);

    //Get Directory where to download file 
    char result[ 512 ];
    DWORD a = GetCurrentDirectory(MAX_PATH,result);

    success = download_file(azure::storage::cloud_blob(container,outfilename), StringToWString(result));

     I observed memory is growing +30 Mb after blob download. Is there anyway to cleaning up memory. Or  is this the problem with library.

    Thanks for the inputs.

    EDIT - Actully increased memory is blob size. Memory grows after this line -

    std::vector<unsigned char> bytes = blob.get().get().data();

    Is there anyway to clenup this memory?

    • Edited by N_Gupta Friday, February 1, 2013 9:44 AM
    Friday, February 1, 2013 8:38 AM

All replies

  • Hi N_Gupta,

    We'll look into this right away.


    Friday, February 1, 2013 3:05 PM
  • You should be able to delete the vector once the data is written to the file which should release the memory. We are currently adding support for streaming the data from the blob for our next release. This would eliminate the need to wait for the entire blob contents to be in memory before proceeding with writing it to the disk.

    --Krishnan (Microsoft).

    --Krishnan (Microsoft)

    Friday, February 1, 2013 8:15 PM
  • Hi Krishnan,Niklas,

    Thanks for your input.

     Further analysis I found that memory leak happnes in this line file_buf.putn(&bytes[0], (size_t)blob_size).wait();

    Not with const std::vector<unsigned char> bytes = blob.get().get().data(); line. 

    How do we take care of memory here?

    Wednesday, February 6, 2013 1:59 PM
  • Hi N_Gupta,

    Yes, we had a memory leak in the file buffer implementation that has been identified and addressed. Our next release will have a fix, but until then, there is nothing you can do except use some other file I/O  (such as iostreams) library for now.


    Saturday, February 9, 2013 1:29 AM