RenderVIewImpl doesn't always get deleted

19 views
Skip to first unread message

Alan Leung

unread,
Nov 5, 2012, 2:19:48 PM11/5/12
to chromi...@chromium.org
Hello:

I am trying to investigate a possible memory leak in Android.

I was able to track down that a listener of RenderViewImpl is not getting deleted because RenderViewImpl isn't always deleted. (This can be easily demonstrated with some printfs)

Looking at the code, it seems like RenderViewImpl reference counts itself with a AddRef at creation and Release at onClosed(). Besides some bind() calls, no one else seems to increment it's reference count.

What is the expected lifetime of the RenderViewImpl? Should it get delete on every onClose()? Is this a possible leak in Chromium?

-Alan



Justin

unread,
Nov 13, 2012, 1:37:48 PM11/13/12
to chromi...@chromium.org
This "self-owning' aspect of RenderViewImpl surprised me the other day and seems a little risky. The only other place I know that has a reference to the view is this guy, declared in render_view_impl.cc:

static base::LazyInstance<ViewMap> g_view_map = LAZY_INSTANCE_INITIALIZER;

Immediately below the AddRef() the RenderViewImpl gets added to this map, I don't know if that also calls "AddRef", but it would be worth checking by printing out refcount() at a few places.

The other clue would be in whatever workflow you used to see this problem - try to simplify that down into the minimum number of steps that should the problem.

cheers,
Justin.
Reply all
Reply to author
Forward
0 new messages