From: Joogab Yun Date: Fri, 2 Feb 2018 05:52:19 +0000 (+0900) Subject: [3.0] fixed memory leak X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b924fc29de4263d7d3fe8c520b21cec2bb7275e;p=platform%2Fcore%2Fuifw%2Fdali-core.git [3.0] fixed memory leak - Dali::Internal::BitmapPackedPixel::mData is allocated twice and freed once only. First one just takes memory during Dali::BufferImage is used. Change-Id: Ib0b1348f9007d4fb3ab088644fb6be2f7430bfee --- diff --git a/dali/internal/event/images/buffer-image-impl.cpp b/dali/internal/event/images/buffer-image-impl.cpp index 2b82133..3019d1c 100644 --- a/dali/internal/event/images/buffer-image-impl.cpp +++ b/dali/internal/event/images/buffer-image-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -144,7 +144,7 @@ void BufferImage::Update( RectArea& updateArea ) void BufferImage::CreateHostBitmap() { - Integration::Bitmap* bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, mResourcePolicy ); + Integration::Bitmap* bitmap = Bitmap::New( Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD ); Bitmap::PackedPixelsProfile* const packedBitmap = bitmap->GetPackedPixelsProfile(); DALI_ASSERT_DEBUG(packedBitmap); diff --git a/dali/internal/render/gl-resources/bitmap-texture.cpp b/dali/internal/render/gl-resources/bitmap-texture.cpp index 58d80c2..f7006c1 100644 --- a/dali/internal/render/gl-resources/bitmap-texture.cpp +++ b/dali/internal/render/gl-resources/bitmap-texture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -283,6 +283,8 @@ void BitmapTexture::Update( const unsigned char* pixels, std::size_t width, std: mContext.PixelStorei( GL_UNPACK_ALIGNMENT, 1 ); } + DiscardBitmapBuffer(); + #if DALI_GLES_VERSION >= 30 // For GLES 3.0, uploading sub-image with different format is a valid operation. Integration::ConvertToGlFormat( pixelFormat, pixelDataType, pixelGLFormat );