-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Steps to reproduce:
With a profiler
- start the sample app
- attach a memory profiler to the render process
- collect memory
- hit the Reload button a few times
- collect memory
- compare results
Bug: JavascriptPropertyHandlers have leaked. More specifically the Func<String^, BrowserProcessResponse^> and Func<String^, Object^, BrowserProcessResponse^> objects have leaked.
With a breakpoint
- set a breakpoint in the JavascriptPropertyHandler.h destructor
- start the sample
- hit reload
Bug: The destructor is not called.
Root Cause
It seems like the call to V8Value->CreateObject in JavascriptObjectWrapper.cpp@25 calls AddRef() but never releases that ref. We can't figure out exactly how/why.
Here is a starting point to fix the issue…
This change is to show how we can force destruction of the wrappers to fix the memory leak.
The wrappers are created in CefAppUnmanagedWrapper::OnContextCreated so here in CefAppUnmanagedWrapper::OnContextReleased I delete the wrappers.
We don't think this fix is the right one. It seems too complicated. We don't understand why the ref count does not go down to zero and I think this is where a fix should be made.
Next?
@amaitland , @jornh Can you guys help come up with a clean fix?