[3.0] fixed memory leak 69/169069/1 tizen_3.0
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 2 Feb 2018 05:52:19 +0000 (14:52 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Fri, 2 Feb 2018 05:52:19 +0000 (14:52 +0900)
  - Dali::Internal::BitmapPackedPixel::mData is allocated twice and
freed once only. First one just takes memory during Dali::BufferImage is
used.

Change-Id: Ib0b1348f9007d4fb3ab088644fb6be2f7430bfee

dali/internal/event/images/buffer-image-impl.cpp
dali/internal/render/gl-resources/bitmap-texture.cpp

index 2b82133..3019d1c 100644 (file)
@@ -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);
 
index 58d80c2..f7006c1 100644 (file)
@@ -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 );