Raw to DNG memory leak issue DNG_SDK

Source: Internet
Author: User

The problem is this, the previous article has introduced how to convert from raw to DNG, including engineering configuration, configuration Library compilation method and how to write DNG, the original test due to a few pictures, when the conversion did not notice the memory leak problem, the leader of the aerial took more than 3,000 raw maps need to turn to DNG, The problem is that the task manager's memory looks up until it snaps, because the DNG class pointers are all smart pointers, so it's fine to think that the space you're applying for is free, but autoptr<dng_image>image (new Dng_simple_image (BOUNDS,PLANES,PIXELTYPE,MEMALLOC)) Statement of the statement, how also can not be released, looking for search, delete all kinds of things, rewrite people's destructor, is to delete, the whole search for half the day, I don't know how to do that. The most annoying is the memory leaks, memory leaks especially annoying is the pointer caused by the memory leaks, search for nowhere, lit countless, only change the way of thinking.

First, there must be delete and free for both new and malloc, and the smart pointer declares that the function has new, which must be delete, but who should delete it? Image No, to see the memory of the image pointer until where it went, it was not found at the beginning, at the bottom of the various deletions, no effect. Change the idea: the place of application Delete, there is released, indicating that delete is possible, do not need any destructor. The next one goes to that, delete it, release it, find it in turn, or until your pointer finally points to where it is, and delete it directly at the end. Raw turn dng,dng_negative *negative = host. Make_dng_negative (); negative writes DNG, so the final pointer is negative, and at the end of the delete negative is done.

Raw to DNG memory leak issue DNG_SDK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.