Giter VIP home page Giter VIP logo

Comments (4)

vadz avatar vadz commented on June 11, 2024

Please try debugging the leak using the same tool you used to detect it in the first place to see where is it coming from.

Also, it's not clear which wxWebView backend you're using: is it the default (and deprecated) IE one or the Edge one (which needs to be explicitly enabled)?

from wxwidgets.

PBfordev avatar PBfordev commented on June 11, 2024

I can reproduce it with GIT master and wxWebViewIE backend (Internet Explorer 9.11.19041), only when displaying a PDF.

Detected memory leaks!
Dumping objects ->
{51989} normal block at 0x000002398A1B0DA0, 48 bytes long.
 Data: < =ll            > 80 3D 6C 6C FB 7F 00 00 01 00 00 00 01 00 00 00 
Object dump complete.

Adding (and verifying afterwards the allocation order number was still the same)

    _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
    _CrtSetBreakAlloc(51989);

to WebApp::OnInit() points to creating wxActiveXEvents instance events here

if ( cp )
{
wxActiveXEvents * const
events = new wxActiveXEvents(this, ta2->guid);
hret = cp->Advise(events, &adviseCookie);
// We don't need this object any more and cp will keep a
// reference to it if it needs it, i.e. if Advise()
// succeeded.
events->Release();
CHECK_HR(hret);
}

events is never deleted, only its interface released. Of course, simply adding delete events leads to a crash. The same code gets executed when a web page is loaded and there is no leak. So maybe the location is wrong? I have forgotten the little I ever learned about COM, but IIRC the usual pattern was the interface instance deleting itself when its reference count drops to 0: Perhaps for PDFs the interface is not released somewhere properly...

Calling wxWebViewIE::MSWSetEmulationLevel() did not help with the leak.

from wxwidgets.

Solosigi avatar Solosigi commented on June 11, 2024

I have tried to exclude this block...

                if ( cp )
                {
/*
                    wxActiveXEvents * const
                        events = new wxActiveXEvents(this, ta2->guid);
                    hret = cp->Advise(events, &adviseCookie);

                    // We don't need this object any more and cp will keep a
                    // reference to it if it needs it, i.e. if Advise()
                    // succeeded.
                    events->Release();

                    CHECK_HR(hret);
*/
                }

Build new library and link my app.
And see: with PDF (i use only PDF) the was no memory leak any more...
Regards
Robert

from wxwidgets.

vadz avatar vadz commented on June 11, 2024

Thanks for debugging this!

AFAICS it really looks like the connection point forgets to call Release() on our objects, but I don't know what to do about it. Removing this code means that no wxEVT_ACTIVEX events will be generated, which doesn't seem ideal, but, in a pinch, we probably could add some flag to disable the events generation if they're not needed anyhow and this would avoid the leak too.

I'd recommend switching to Edge backend in any case.

from wxwidgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.