Memory "leak" when using the C API

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Memory "leak" when using the C API

Postby bclai » Tue Sep 22, 2009 9:33 pm

Hi!

I am using the CEF's C API to implement my application. On cef_shutdown, there are unreleased objects.

From the code, it looks like CEF's Wrap function will increment the reference count. Since I am not doing anything on the C-side (application-side) yet, there reference count increases everytime the handler is called.

So my question is, am I supposed to release all CEF objects manually on the C-side (application-side)? Or is there a way to generate the inverse CEF C++ wrappers for use on the application-side.

I also encounter this issue, but in reverse, when I export an object to Javascript from the application. set_value_bykey will decrement the reference count, so I currently increment the reference count manually before calling set_value_bykey.

While I can use C++, I cannot use the CEF C++ API directly because my application links to the standard libraries as a DLL, while CEF/Chromium links to them as a static library. If I remember correctly, it causes link errors. This is why I am using the C API instead.

Thanks in advance.

Johnny
bclai
Newbie
 
Posts: 1
Joined: Tue Sep 22, 2009 8:54 pm

Re: Memory "leak" when using the C API

Postby magreenblatt » Thu Sep 24, 2009 11:49 am

Please read the Wiki post on C API reference counting: http://code.google.com/p/chromiumembedd ... ingTheCAPI

If you build the libcef_dll_wrapper project with the same runtime configuration as your application then you shouldn't have any linking problems when using the C++ API.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 100 guests