From: Kyeonghun Lee Date: Tue, 11 Apr 2017 04:40:04 +0000 (+0900) Subject: add code for memory management X-Git-Tag: submit/trunk/20170823.075128~97^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0fd449990fbc594011b5bf2481825bbda59216e;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git add code for memory management Change-Id: If38d4ea73e29158e4c582e55552d8d95bf07ff74 Signed-off-by: Kyeonghun Lee --- diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/Message.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/Message.cs index b47859a..e0e27f2 100755 --- a/src/Tizen.Messaging/Tizen.Messaging.Messages/Message.cs +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/Message.cs @@ -27,6 +27,7 @@ namespace Tizen.Messaging.Messages { internal IntPtr _messageHandle = IntPtr.Zero; private bool disposed = false; + private int _memoryPressureSize = IntPtr.Size * 11 + sizeof(int) * 5 + sizeof(bool) * 5 + sizeof(short) * 2 + sizeof(byte) * 1176; private ICollection _from = new Collection(); internal ICollection _to = new Collection(); @@ -41,12 +42,15 @@ namespace Tizen.Messaging.Messages Log.Error(Globals.LogTag, "Failed to create message handle, Error - " + (MessagesError)ret); MessagesErrorFactory.ThrowMessagesException(ret); } + + GC.AddMemoryPressure(_memoryPressureSize); } internal Message(IntPtr messageHandle) { _messageHandle = messageHandle; GetAllAddresses(); + GC.AddMemoryPressure(_memoryPressureSize); } internal void FillHandle() @@ -64,6 +68,7 @@ namespace Tizen.Messaging.Messages { Dispose(true); GC.SuppressFinalize(this); + GC.RemoveMemoryPressure(_memoryPressureSize); } private void Dispose(bool disposing)