question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ignite control not garbage collected after component destroyed

See original GitHub issue

Currently we are trying to develop application with angular4 with ignite ui, and we use Angular4 router with ignite ui controls, we found that ignite ui control may not be correctly garbage collected after component was destroyed.

the reproduce repo is attached. to reproduce

  1. ng serve
  2. click Add in the top menu
  3. click Home in the top menu
  4. repeat 2-3

And the memory will continue to increase even I force GC. And I compare the Heap, the HTMElement was not garbage collected.

And if I use the ig-date-picker in addContactscomponent in addcontact.component.html Line 68, if I change it to normal input, everything work fine.

Please help! Thank you!

Update, use a more simple demo with only one ignite-text-editor ig_memory.zip

Update 7/6

I just compared the chrome heap snapshot, and the ig-text-editor component was increased continually when I click Add page, it seems the ignite component was still hold by angular. should I remove the listener or subscriber in ngOnDestroy()?

Update 7/6

  1. I add the following code in ngOnDestroy
    @ViewChildren(IgDatePickerComponent) dates: QueryList<IgDatePickerComponent>; 

    ngOnDestroy() {
       dates.forEach(date => date.destroy())
    }

Memory leak is improved, but not resolved.

  1. I look into the compare heap, and found the leak add more code in ngOnDestroy,

memory

And found some listener are not destroyed, so I add more codes to remove listeners

   ngOnDestroy() {
        console.log('destroyed');
        if (this.dates) {
            this.dates.forEach(date => 
            {
                const el = (date as any)._el;
                              $(el).off('igdatepickervaluechanged')
                $(el).off('igdatepickerblur')
                $(el).off('igdatepickerselected')
                $(el).off('igdatepickerrendering')
                $(el).off('igdatepickerrendered')
                $(el).off('igdatepickermousedown')
                $(el).off('igdatepickermouseup')
                $(el).off('igdatepickermousemove')
                $(el).off('igdatepickermouseover')
                $(el).off('igdatepickermouseout')
                $(el).off('igdatepickerfocus')
                $(el).off('igdatepickerkeydown')
                $(el).off('igdatepickerkeypress')
                $(el).off('igdatepickerkeyup')
                $(el).off('igdatepickervaluechaning')
                $(el).off('igdatepickerdropdownlistopening')
                $(el).off('igdatepickerdropdownlistopened')
                $(el).off('igdatepickerdropdownlistclosed')
                $(el).off('igdatepickerdropdownlistclosing')
                $(el).off('igdatepickerdropdownitemselected')
                $(el).off('igdatepickerdropdownitemselecting')
                $(el).off('igdatepickertextchanged')
                $(el).off('igdatepickeritemselected')

                $(el).off()
                date.destroy()
            });
        }
        this.dates = null;

    

It seems this can remove all listeners, but maybe different editor have different listeners. so maybe we should add the off() logic in IgControlBase.ngOnDestroy()/

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kdinevcommented, Jul 6, 2017

@JiaLiPassion Seems to me that there may be a problem, not only with the missing ngOnDestroy which we will correct but also with the editor’s destroy.

@bazal4o Could you look at the editor’s destroy to see why there event handlers remain?

0reactions
JiaLiPassioncommented, Jul 31, 2017

@kdinev, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignite doesn't free memory after cache destroy
P.S. I just created a test that creates and destroys caches with data in a loop. It works fine for me, memory is...
Read more >
Actor Component gets destroyed soon after creation ...
I'm experiencing troubles with the GC too. It collects my object (saved via a UPROPERTY), as well as the MovementComponent (the default one,...
Read more >
Apache Ignite
The Apache Ignite internals has the so-called switch (a part of Partition Map Exchange) process that is used to perform atomic execution of ......
Read more >
Tricks of the Trade: Tuning JVM Memory for Large-scale ...
The JVM garbage collection process looks at heap memory, identifies which objects are in use and which are not, and deletes the unused...
Read more >
How we use Apache Kafka to improve event-driven ...
Event processors write to the Apache Ignite distributed database, ... Tuning garbage collection (GC) helps avoid long pauses and excessive ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found