RESOLVED FIXED 94808
[EFL][WK2] Free ewk context data on program exit.
https://bugs.webkit.org/show_bug.cgi?id=94808
Summary [EFL][WK2] Free ewk context data on program exit.
Kangil Han
Reported 2012-08-23 06:59:43 PDT
Current implementation doesn't delete ewk context data. This patch fixed it by adding Ewk_Context to Ewk_View_Private_Data and deleting it explicitly when private data is deleted.
Attachments
patch (3.38 KB, patch)
2012-08-23 07:06 PDT, Kangil Han
no flags
Patch (4.41 KB, patch)
2012-08-23 09:03 PDT, Chris Dumez
no flags
Patch (2.68 KB, patch)
2012-08-23 09:41 PDT, Chris Dumez
no flags
Patch (2.69 KB, patch)
2012-08-23 09:46 PDT, Chris Dumez
no flags
Kangil Han
Comment 1 2012-08-23 07:06:41 PDT
Ryuan Choi
Comment 2 2012-08-23 07:30:29 PDT
Comment on attachment 160153 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=160153&action=review > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:118 > + ewk_context_free(context); I think that it is wrong because we can remove two ewk_views which use default context.
Chris Dumez
Comment 3 2012-08-23 07:39:44 PDT
Comment on attachment 160153 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=160153&action=review >> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:118 >> + ewk_context_free(context); > > I think that it is wrong because we can remove two ewk_views which use default context. Yes. eunmi already has a patch to make Ewk_Context ref counted and solve this problem.
Chris Dumez
Comment 4 2012-08-23 07:42:10 PDT
Please see Bug 89186.
Chris Dumez
Comment 5 2012-08-23 07:49:27 PDT
Comment on attachment 160153 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=160153&action=review >>> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:118 >>> + ewk_context_free(context); >> >> I think that it is wrong because we can remove two ewk_views which use default context. > > Yes. eunmi already has a patch to make Ewk_Context ref counted and solve this problem. Also, Ewk_Context is currently a static variable returned by ewk_context_default_get() so you cannot free it like this.
Chris Dumez
Comment 6 2012-08-23 08:09:01 PDT
This is not really a leak. We use singleton pattern so the variable lives as long as the program. The memory will get freed by the OS on exit.
Chris Dumez
Comment 7 2012-08-23 09:03:43 PDT
Created attachment 160179 [details] Patch New proposal.
Ryuan Choi
Comment 8 2012-08-23 09:09:15 PDT
Comment on attachment 160179 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=160179&action=review > Source/WebKit2/UIProcess/API/efl/ewk_context.cpp:214 > - static Ewk_Context* defaultContext = createDefaultEwkContext(); > + if (!defaultContext) > + defaultContext = new Ewk_Context(adoptWK(WKContextCreate())); > > return defaultContext; > } > > +void ewk_context_default_free() > +{ > + delete defaultContext; > + defaultContext = 0; Are there any issue if we just change like below ? (might be DEFINE_STATIC_LOCAL) Ewk_Context* ewk_context_default_get() { - static Ewk_Context* defaultContext = createDefaultEwkContext(); + static Ewk_Context defaultContext(WKContextCreate()); - return defaultContext; + return &defaultContext; }
Chris Dumez
Comment 9 2012-08-23 09:41:23 PDT
Created attachment 160185 [details] Patch Take ryuan's feedback into consideration. Note that I cannot use DEFINE_STATIC_LOCAL because of the way it is defined (it calls "new" internally).
Chris Dumez
Comment 10 2012-08-23 09:46:01 PDT
WebKit Review Bot
Comment 11 2012-08-23 11:02:12 PDT
Comment on attachment 160186 [details] Patch Clearing flags on attachment: 160186 Committed r126448: <http://trac.webkit.org/changeset/126448>
WebKit Review Bot
Comment 12 2012-08-23 11:02:16 PDT
All reviewed patches have been landed. Closing bug.
Kangil Han
Comment 13 2012-08-23 18:13:59 PDT
I feel really really bad why chris landed this patch without asking my opinion. He had to review my patch and let me finish this!
Gyuyoung Kim
Comment 14 2012-08-23 19:07:13 PDT
(In reply to comment #13) > I feel really really bad why chris landed this patch without asking my opinion. He had to review my patch and let me finish this! Was there any discussion ? I don't barely see other contributor landed a patch without asking original patch owner.
Gyuyoung Kim
Comment 15 2012-08-23 19:11:34 PDT
(In reply to comment #14) > Was there any discussion ? I don't barely see other contributor landed a patch without asking original patch owner. Oops, typo. s/don't barely/barely/g
Kangil Han
Comment 16 2012-08-23 19:33:51 PDT
(In reply to comment #15) > (In reply to comment #14) > > > Was there any discussion ? I don't barely see other contributor landed a patch without asking original patch owner. > > Oops, typo. s/don't barely/barely/g Nope, chris never asked me about landing his code on my bug. Source code diff might be small, but the process on detection was really hard stuff. That's why I am so angry at him!
Note You need to log in before you can comment on or make changes to this bug.