Debugging Memory Leak - memory-leaks

I'm trying to figure out where my memory leak is coming from since lately i'm experiencing a lot of performance drop when just opening a new tab on my browser FireFox ver.51
Just to be sure I've disabled all non-Microsoft startup services in msconfig even after reboot it still gets stuck on this.
Looking up on the vendors updates for this machine then it would be up to date on the drivers, i do occasionally check for Intel Chipset and onboard Graphics drivers (stable versions only) myself that are a few years newer then the vendor.
MS Resource monitor
MS Taskmgr Perfomance monitor
In the Taskmgr Performance monitor you can see I'm barely using any CPU and I/O leaving out any form of I/O wait issues due to swapping.
When looking in the Resource monitor actual physical RAM in is about 6.3GB while Cached is only 1.6GB making it roughly 4GB RAM missing where it's usage is coming from.
So i did do a offline MemTest (oh yes the old blue gorgeous BIOS screen) and all checks were passed, luckily it's only 8GB RAM so the downtime is manage-able ;)
Any ideas or other handy tools I can use to find the culprit?

Already fixed it, seems like my pagefile is storing too much cached memory for some reason, will look into it myself why it stores so much memory

Related

Android studio emulator/AVD very high disk load (Linux)

I'm trying to use the android emulator coming with Android Studio (4.0) on Mint 18. Unfortunately as soon as I run a device, my disk sees heavy workload and I can't really tell why - it must be many small writes as I can see in nmon. This renders the whole emulation completely useless as the emulated device is not really responding any longer. It does not depend on which device I'm trying to emulate (Pixel/Pixel2/own HW).
What I can't see is, which files are affected and why. Even iotop only tells me that qemu-system-i386 is putting some workload on the disk but not where (of course).
The only thing I can tell is that all magic disappears if I start the device from commandline with the "-read-only"-Argument - then everything runs fine and fast.
But that's not a solution anyway because it doesn't preserve changes on the emulated device.
Any ideas?
I totally agree with Raman's comment: too much disk write. When I am using the android studio( "version": "dev build","buildNumber":"203.7717.56.2031.7678000",) emulator, the process with highest real time "disk write" value in gnome's system monitor, can reach 40 or 50 MB/s, which is quite astonishing. 40 or 50 MB/s not only in the start or end of emulation, it also happens as long as I make any operation in virtual device(i.e., swiping, clicking, opening apps). (BTW, ubuntu 20.04, ryzen 4800h, 16GB 3200 ddr4 dual channel RAM, emulating pixel 4, android 11 x86 with google play). I am also trying to find out why.
May be you could reduce the "disk write" by disable quickboot snapshot? I disabled automatic snapshot, and take a snapshot manually. Then disabled the quickboot, and set the default boot option from "quickboot" to "boot from one specific saved snapshot". Please remember, after setting the cconfiguration, you must reboot your PC to validate the settings, otherwise the settings may or may not take effect, or you simply could not open emulation unless reboot.
After rebooting, the "disk write" value drops down from 40 or 50 MB/s to a normal range, less than 1 MB/s in most of times. However, after rebooting, I could not read articles from official accounts in wechat app(from tencent company) in emulated android device. The articles are just stuck in loading status after clicking. So this setting may also affect some of normal functionalities.
https://developer.android.com/studio/run/emulator#snapshots
https://developer.android.com/studio/run/emulator#quickboot-troubleshooting
"Loading or saving a snapshot is a memory-intensive operation. If you do not have enough RAM free when a load or save operation begins, the operating system may swap the contents of RAM to the hard disk, which can greatly slow the operation. If you experience very slow snapshot loads or saves, you may be able to speed these operations by freeing RAM. Closing applications that are not essential for your work is a good way to free RAM."
For your description, "But that's not a solution anyway because it doesn't preserve changes on the emulated device." You could simply take a snapshot manually when you need to save, and set it as your boot snapshot.
I noticed it happened quite much for emulated devices with Google Play or Google Api images. Also, after waiting quite a while (let say 10 minutes), the phenomenon stops. What I do is to use, whenever possible, devices with low API levels, then with no Google Play image, and better, no Google Api at all. I also try to allocate quite a lot of ram to the emulated device (at least 3G). It is really astonishing how an emulated Android device with api level 15 is fast compared to a api level 30 or 31.

Running two emulators: one is always too slow

I am trying to run two AVDs side by side. The thing is that whichever AVD I open second, runs MUCH slower than the first one. It's not CPU or RAM, there is enough overhead.
Any ideas?
I was also experiencing the same issue where the 2nd emulator was slow as molasses. I did some research on this and I think I have found a pretty decent solution. I am assuming that you have already installed Intel HAXM. If not, then please do so.
For best performances, it is advised that you allocate atleast half of the system RAM to Intel HAXM. This has been mentioned on the Intel HAXM page here under the Tips & Tricks section.
I allocated about 6 GB RAM to Intel HAXM and after that the performance of the 2nd emulator improved by a great deal. I would highly recommend you do the same. If you have already installed Intel HAXM, then please uninstall it and install it again with the amount of RAM as suggested on the above mentioned page.
Increase the memory that can be allocated to HAXM. When you install it you will notice a line in the final screen:
Note: The memory reservation setting can be changed by running this installer again.
Navigate to AndroidSDKDirectory/extras/intel/Hardware_Accelerated_Execution_Manager
Run the installer (not the silent installer) and manually adjust the HAXM memory limit on this screen:
At the time of this writing a stock Pixel (XL) emulator uses 1536 MB memory by default. So if you want to have enough memory available to HAXM to run 2 of these emulators, allocating ~4096 MB (a third more than necessary) is a safe bet.

kvm balloon driver results in different total-memory then requested

I have ubuntu and installed on it several qemu-kvm guests, running also ubuntu.
I'm using libvirt to change the guests' memory allocation. But always encounter a constant difference between the requested memory allocation and the actual memory allocation I query from the Total field in the top command inside the guests.
The difference is the same in all the guests, and consistent.
In one machine I installed it is 134MB (allocated is less then requested), In another one it is 348MB.
I can live with it, I just don't know the reason. Does someone encounter this kind of problem? Maybe solved it?
Thanks
This constant difference is likely the space reserved by the kernel. Note that this amount of space will increase (at least in Linux) as you have more physical memory available in the system. The change you're seeing is probably due to kvm giving that particular guest more or less memory to work with than it was before.
If you're interested, here is a quick article on memory ballooning, as implemented by VMWare ESX Server.

Linux version of Windows "nonpaged pool" does such a thing exist?

I have been working with an Windows application which reads from the 'nonpaged pool' to increase performance. In this case the nonpaged pool is the area of memory where the network drivers write data as they grab it off the wire.
How does Linux handle memory which network drivers (or other drivers) which require high speed exclusive access to RAM and does the question 'how do I read directly from nonpaged pool?' even make sense when applied to Linux?
Many thanks
related question
Some networks like Infiniband support RDMA, which requires being able to prevent paging for some of the pages in a process. See the mlock(), mlockall(), munlock(), munlockall() functions.
Other than that, I don't think there is a concept of "nonpaged pool", per se. Generally, kernel memory is AFAIK not pageable, but all user memory except that locked with mlock() or such is.

Apple's mobile operating system

am new in iphone technology i just wanted to know what is the memory that ios4 occupies in the iphone, i have read that i phone 4 has 512MB of RAM and in wiki i read that ios uses 500MB of ram so am bit confused like if it uses 500MB of ram then it leaves only 12MB free memory space for third party app, please help me out regarding this.
Thank you
It's not something you need to worry about.
If you needed to know, the information would be available.
Write your application and, if it uses too much memory, then optimise it.
You will receive memory warnings if you start to approach the memory limit, which you can respond to appropriately.
It uses 500mb of swap space, which is space on the phone's actual storage, not RAM.

Resources