High resource usage while running CodeSchool angular.js tutorial - angularjs

I'm using a late-2011 MacBook Pro with recently upgraded 16GB ram. Recently I'm experiencing high system resource usage when I'm doing the Angularjs.org Free Course provided by CodeSchool - "Shaping Up with Angular.js".
Angular.js is a framework for responsive web app, and, I believe the CodeSchool campus itself is also a responsive web app. I would expect it takes up a little bit more resources but what I'm experiencing is just too much:
Laggy - the screen freeze while I type, after I finish typing the whole line of code (a few seconds), the words come out.
Spinning Beach Ball - if I keep it too busy, such as while I'm going to scroll around and check my codes for possible mistake, the Spinning Beach Ball may appear.
But everything is just became such abnormal while I'm focus on that website. From the Activity Monitor, I observed that:
Memory - http://campus.codeschool.com is taking up 1GB ~ 3GB memory consistently.
CPU - something may be wrong with WindowServer process, as I've actually never seen it appearing on the top of my list before this.
Anyone has some clues on what's going wrong? Possible cause?

Related

React app suddenly is using more than 1 GB of RAM on Chrome

I've been working on an app I'm building, and until now it's had a reasonably small footprint. Today, however, I was looking into why my computer was suddenly running slowly, and I can see the app in Chrome is occupying around 1.2 GB of RAM!
Looking through my commits, I can't really spot anything suspicious. Where should I look when trying to debug enormous memory usage? I'd post code examples, but I can't see anything relevant, really.
To check what React is doing, try go get a snapshot of your app using the React profiler: Introducing the React Profiler
For everything else, try checking out the built-in profiler in the Chrome developer tools: Chrome DevTools: JavaScript CPU Profiling in Chrome 58
Those should be two good starting points to look at.
Sorry, we might need some more clarification about what you've tried.
It could be a ton of things. Most likely you're storing some sort data from the server or have some sort of memory leak (like adding something to a collection, but never deleting it).
One thing you can do is use the Chrome profiler to see when your memory climbs:
(This can be found in the drawer that open when you push Esc.)
The "Performance" tab can also be nice if you want to view the memory on pageload (using the 🔄button). Just make sure that memory is checked.

How to find what freezes Chrome when it runs an AngularJS application?

I'm inspecting a performance issue with an AngularJS application.
When performing specific actions, the CPU usage goes to 100%, the Chrome window freezes, and I have to manually terminate the process using Chrome's task manager.
I tried to debug the app (DevTools' Sources tab), but the application is quite large and the code is minified, which means that finding the issue won't be easy: I see a lot of code triggered by the digest cycle, and can't figure out which code is the actual culprit.
What could be helpful is to be able to profile the application once it freezes; I'm pretty sure the profiler will immediately show the actual bottleneck. I can successfully start the profiler (Performance tab) before the freeze happens, but once the application freezes, when I click on Stop button, the Loading profile window is stuck at zero percent (I waited for fifteen minutes just to be sure, it's still at zero), so I suppose that it's frozen as well.
Therefore my question is:
How do I find what causes the application to freeze when I'm unable to figure it out by simply debugging the application?
To answer my own question, the solution was to use a different browser. Surprisingly, Firefox let me profile the application during the freeze. The remaining part was easy, as I expected: by comparing the profiling results before the freeze with the ones after it, one could figure which code is executed repeatedly.
Thanks to Aleksey Solovey as well for his comment.

Guide to acceptable "Live Bytes" of iOS6 app using MKMapView

I am looking to ensure my app does not consume too much memory on what are still fairly resource constrained devices. Several days ago I was using Instruments to determine how much memory my app was using and I was getting around 4-8 megabytes for Live Bytes. Today I run Instruments again and I am up around 30-35 megabytes for Live Bytes. I don't believe I have made any significant changes to my code between these two times.
My app uses an MKMapView with a custom tile overlay. I put off updating XCode for a fairly long time, and so I suspect that the difference may be that my iOS simulator was still using Google as opposed to Apple maps a few days ago, until I upgraded XCode.
As a small test, I created a new test app that just has an MKMapView, nothing else, and ran Instruments on it. It is common for the Live Bytes of this app to be on the order of 50-90 megabytes, even though it has no custom code whatsoever - I just drag n' dropped the MKMapView on.
Whether this is intentional on Apple's behalf for the new maps to use this much memory I do not know. Perhaps the map tiles are shared across apps and this is fine. Either way though, it complicates coming up with a reasonable approximation for how many Live Bytes I can safely use, given that most earlier suggestions are on the order of 5-20MB, and Apple's MKMapView consumes 50-90MB on its own.
Is there another useful metric I can go by failing Live Bytes being any use now?
Edit: looks like for others this is a legitimate memory management problem and causing app crashes: iOS6 MKMapView using a ton of memory, to the point of crashing the app, anyone else notice this?

Stability issues with WPF MediaElement (MediaFailed, slow-motion video), are there workarounds out there?

I have a couple issues with it:
media fails to play and continues to fail until the application is restarted
audio plays normally but video is in slow-motion and will not play normally until the application is restarted.
there's no way to reinitialize other than an app restart. (that I know of)
there's no real solid way to know if a video is rendering. I can observe Position to verify it is playing but it's not a guarantee there's any video output.
I run two instances of an extended version of MediaElement in my WPF app which hinges on their stability. After many tests I've concluded that it's the highest performing video player out there, above MediaKit and vlcdotnet, due to using solely GPU to decode. I've encoded videos in WVC1 (Windows Media Video AP#l3 VC-1) for 1080p quality and relatively small file sizes. Eventually after several plays the videos will fail to play, at which point the MediaFailed event is fired and subsequently stops working altogether until the application is restarted.
It is my understanding that when it fails like this, it's a core failure within the underlying Windows Media Player OCX control and it cannot be fixed in any way other than a full application restart. Has anybody found any reliable workarounds for these issues? Mum's the word over at the Microsoft forums...
Answering my own question here to possibly facilitate future SO'ers who might run into these issues. The issue lies in WPF, it is not planned to be improved. For a more reliable solution with minimal overhead, try WPFMediaKit.

What could be reasons a WPF app would pin the CPU and lock the app on some computers but not others?

Stumped here. Posted a similar question before. We have a pretty large WPF app that on some machines runs great, but on others, all of a sudden, one of the CPU cores gets pinned at 100% (just one core) and the app freezes. It usually seems to happen when showing a context menu or a combobox drop-down (i.e. Popup controls) which is why we can't debug this since no user code is executing at that time. It's driving us crazy because again, on most machines it runs fine, but on a few, it freezes.
The odd thing is when we run it in a VM, it runs great there too! Crazy! Not sure what's causing this, or more importantly, where to even begin to look because as I said, no user code is running.
This happens on only about 10% of our machines, but it consistently happens on those machines. All are clean (i.e. relatively fresh OS installs, no crazy apps, etc.) and mostly identical machines spec-wise: similar CPUs, similar RAM, same video drivers and service packs.
So as I stated in the title, can anyone suggest possible reasons why a WPF app would pin the CPU and lock the app on some computers but not others? We're just stumped!
Found it!! Turns out there's a bug in .NET 4.0 regarding UI Automation and the changes MS introduced. Here's the info, and the fix! (Note: Even if you call MS, they will send you a link, but it's always a broken link. I managed to track this down manually.)
Note: Their article talks about a specific case that causes this behavior, but if you google around, you'll see tons of issues around hangs related to those DLLs. The latest is they're promising a fix in the .NET 4.5 runtime (from a MS post on this issue.)
Here's the KB article...
http://support.microsoft.com/kb/2484841/en-us
...and here is the actual hotfix.
http://archive.msdn.microsoft.com/KB2484841/Release/ProjectReleases.aspx?ReleaseId=5583
Crappy video driver? Pull two machines - one where it happens, one where not, and start analyzing differences. Could be hardware defects, bad video drivers, anything in that area. WPF uses the GPU to render if one is there.
Since you seem quite to lack options, i would advice to make a new project with just most basic ComboBox in the Window, doing almost nothing. This should work (check :-) ). Then you add features one by one in the ComboBox and test, for instance when you add command, start with empty one. Do this until it 'breaks'. So you know which feature is the culprit.
You didn t say if all was working with software rendering.

Resources