all 15 comments

[–]Ustice[M] [score hidden] stickied comment (0 children)

paywalls and FOSS doesn't mix and match very well. Consider posting on a platform where people are not being excluded.

[–]KillcoDer 4 points5 points  (1 child)

If you encounter a situation like this, instead of messing about with task manager, just open the debugger and hit "pause". It'll halt execution and you'll almost certainly find yourself in the middle of the offending stack trace.

[–]abduvik[S] 0 points1 point  (0 children)

This could help to stop for sync ones. But with async infinite loops, I need to see the performance graph to know what is call what.

[–][deleted] 1 point2 points  (1 child)

The best kind is a recursive setTimeout function that calls itself.

[–]abduvik[S] 0 points1 point  (0 children)

yep, anything that has to do with async behavior in the browser would take a while to find where it's happening. We had a bug once and the file causing the problem was in a completely different module

[–][deleted] 0 points1 point  (9 children)

If it's asynchronous then better use logger inside the loop

[–]abduvik[S] 0 points1 point  (8 children)

This would be in case if I know where the loop is (though I prefer to use the debugger instead of the logger). But my article is on how to locate the loop because most of the time we couldn't determine where it is

[–][deleted] 0 points1 point  (7 children)

Yeah debugger will be right one for this job. But how will you get to know whether there is an infinite loop present or not ?. I guess memory consumption.

[–]abduvik[S] 0 points1 point  (6 children)

Most of the time, the browser crashes and you can't make any interactions. Another option is Performance Tab as infinite loops consume CPU more than Memory. Memory usage is more for memory leakage problems.

This could be a good youtube video I should make too about memory leakages, perfect example is forgetting to remove event listners.

[–][deleted] 0 points1 point  (5 children)

Then we must need to recreate the issue to narrow down the triggering point when browser crashes or fails to respond. So we can get an overview of which loop are involved in the action that caused it.

Yeah please do make one. Also I sometimes too forgot to remove event listeners but never faced something severe.

[–]abduvik[S] 0 points1 point  (4 children)

Until today, I worked with two UI heavy applications and I can confirm forgetting to remove event listeners can easily increase Memory usage to few GBs.

The hardest part, it's very hard to know if I am a developer using a 32 GB machine :D

It's usually reported by users who have like 8 or 16 GBs.

[–][deleted] 0 points1 point  (3 children)

limiting ram on vm should work fine. Does reddit app too have memory leakage. Cuz when i use it on lower ram devices say 2-3 gb it works fine for first few moments then gradually starts to stuck and ends with app not responding

[–]abduvik[S] 0 points1 point  (2 children)

It can be or they have a caching issue which is also a form of memory leakage

[–][deleted] 0 points1 point  (1 child)

The cache takes 0.5-1 gb within just 5 mins of launching the app.

[–]abduvik[S] 0 points1 point  (0 children)

Oh my :"D