Is there any memory limit for Google Chrome browser? - javascript

What is the default memory limit for a single tab in chrome ??

It's hard to answer correctly and the answer could be figured out only in benchmarks for particular task with particular build.
There are several thing that could allow you to use from 1 to 2 GB of memory:
Chrome version: because different V8 engines have different memory limits.
Chrome platform: 32-bit or 64-bit.
Operating System itself: chrome could be built with different flags for different platforms.
Again, Chrome version: there are some discussion on the internet about recompiling chrome with some compilation flags that could allow to use more memory, then chrome developers decide to exclude such flags because of some reasons. Who know — maybe they will include them again or will increase default heap size.
Video memory: in some cases page's content may require some video memory and, if your video adapter has no sufficient amount, Chrome will take it from general memory, which will increase memory usage for the page.
Right now, with 64bit Chrome version 47, on Windows 8.1 I can take up to 1.8GB with one tab, then it crashes.
Update:
As I can see some magic has happened and limit has changed.
For Chrome version 63, on x64 Windows 10 OS, I could allocate up to 3.5 GB memory, parsing a huge JSON string and then displaying it on the page.
The number is taken from Chrome's Task manager and from Process Explorer's Private Bytes metric.

There was some talking about a very similar topic. Here
You should try the following:
Right click on the Chrome icon and go to properties. Chrome should be here:
"C:\Documents and Settings\%USER%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"
Where %USER% is your username on your PC, obviously ;)
At the end of the line add --purge-memory-button
It should look like this:
"C:\Documents and Settings\%USER%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --purge-memory-button
Now, when Chrome works, press shift+Esc, and now you have a new option, "Purge Memory" which frees up memory. The tabs that do not need attention at that particular time will be purged from your RAM.
You can also add one of these lines:
Never voluntarily relinquish memory
--memory-model=high
Voluntarily reduce working set when switching tabs
--memory-model=medium
Voluntarily reduce working set when switching tabs and also when the
--memory-model=low
Browser is not actively being used
You can have several lines after the target place "C:\Documents and Settings\%USER%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"
Let's say we wanna use the "Purge memory" line and the "Low memory model" line. It would look like this:
"C:\Documents and Settings\%USER%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --purge-memory-button --memory-model=low

You can have a perfect answer once you benchmark on a specific platform with a specific version. The outcome will only be applicable to that platform and chrome version you experimented because there is so many factors that may have a different effect in results including,
The Chrome Version may have different v8 engines and not all v8 engines have the same memory limits. Also, the 32 bit and 64-bit architecture come into picture when we benchmark the chrome. The default heap size may varies from v8 version to version.
The system configuration on which you run the chrome. chrome requires the graphics memory/video memory and when you don't have that, It will use internal memory resulting in more memory usage.
It's also related to process itself, every thread requires some memory for bookkeeping, notably its stack. 32-bit processes can only address 4 GB of memory. 64-bit processes don't have problems with address space, but rather with the actual allocations. However, programs should not approach any such limit or need to worry about it and the same applies to chrome as well.
I tried once to export and print the database from PHPMyAdmin from chrome. It had 1.22GB of size in DB and chrome crashed. Same thing I performed to file export and magically it worked fine.
About the v8 engine, it has 512MB memory limit on 32bit system and 1434MB(1.4 GB) on 64bit system. The chrome has v8 it's heart, this is a major factor affecting the memory limit.

I was able to increase the memory limit for my nw.js (chrome) based destkop app by passing following command line options:
Node.js: node --max_old_space_size=12288 script.js
Google Chrome: chrome.exe --js-flags="--max_old_space_size=12288"
NW.js: add "js-flags": "--max_old_space_size=12288" to the package.json.
Adjust 12288 (12GB) to suit your needs

if you're running 32-bit Chrome, you can't allocate more than 2 GB, because that's the process limit for a 32-bit Windows process. for 64bit chrome there is 4gb limit.
Chrome doesn't allow allocations over 4Gb

Related

website crashes in IE, possibly a memory leak?

A website I'm working on crashes in IE8 through 10. I have been trying to determine if it is related to a memory leak, but the tools available for IE are not really great. I've tried using Sieve ... as well as dynaTrace ... Sieve reports no memory leak, but does report on multiple orphaned dom nodes. dynaTrace does not support memory analysis in IE, and the issue does not seem to present itself in Firefox.
I've reviewed heap snapshots in Chrome Dev Tools... and garbage collection seems to be fine there after about 10 seconds or so of the site loading.
Here is the site in question: http://midlandsbiz.whosonthemove.com/
After several minutes on the site in IE, my AVG will pop-up saying that it is consuming too much memory. This is also evidenced by my fan whirring on my laptop, and the ultimate crash of the site.
This happens on multiple computers, on different networks, using different versions of IE.
I was also able to replicate the issue using the WP theme author's site:
http://kopatheme.com/demo/passion/
I'm getting no response / support at all from the WP theme author about this issue.
I was hoping that someone had some ideas on what might be causing this... or could point me in a direction for some tools that I can use to profile javascript memory usage in IE?
You have some major memory leaks and a HUGE memory footprint. There are actually great memory profiling tools in IE, just open F12 and choose the memory profiling tool. You will want to start a profile. When you take a snapshot you will get a simple visual telling you the size of the page in memory and how many objects. When you have a memory leak you will see a blue circle with the number of leaks. Clicking on that will take you to a view of the objects and you can swim through the tree to find the source of your issues.
I can also tell you have many fundamental performance issues in the site. You have over 200 HTTP requests and 4MB of content. You also have many 404s.

Chrome Heap Snapshot - Why it doesn't show all the memory allocated?

I'm running some memory usage tests in a WebGL project that I have. If I start the page on Google Chrome and take a heap snapshot on the Profiles tab of Developers Tool, it will say that my page is holding 7.5 MB.
The problem is if I look into Task Manager, the real value that it is using is almost 1 GB! It is expected, since I am really forcing the page to have thousands of objects, but the question is: why Chrome shows to me that I am using only 7.5 MB?
update
there was native memory snapshot that was able to show you the native memory graph.
Unfortunately we removed it because it was a fragile piece of code.
It required nontrivial instrumentation in hundreds of classes and affected the binary size.
I hope we reimplement it later.
was
It takes a snapshot of Javascript heap. All your javascript objects use 7.5mb. This size doesn't include images, canvases, audio files, plugin data, etc.
There is a native memory snapshot in DevTools.
It counts non-javascript memory used by the renderer process but this is an experimental feature.
You need to enable DevTools experimental feature in chrome://flags, restart the browser, enable Native Memory Profiler experimental feature in DevTools settings panel and reopen DevTools.
After all these steps you will be able to take Native Memory Snapshot in Profiler panel.
Not all the memory chunks in the native memory heap are counted but we are working on that.
Please use the Canary version of Chrome.
It updates every day and works side-by-side with other versions of Chrome.
If your page eats gigabytes of memory and has big "Other" bar, more than 10%-20%, please drop a mail about that to the Google Chrome Developer Tools Foums.
You can still take snapshots under the profile tab and click take head snapshot which gives you in-depth memory usage stats.

Profiling a Chrome application

We are creating a Chrome application that we hope to release in the coming weeks. We have already distributed to a bunch of alpha testers, and, even though feedback is generally good, we have had complains by a bunch of users that our extensions is expensive in terms of RAM.
We also had reports of a too high CPU consumption.
Now, we have improved what seemed obvious, but we are almost 'blind' in terms of execution.
What would be the good strategy to profile both memory and JS calls for our Chrome application?
Please note that this application is a full native application, so maybe we can apply some generic javascript profiling tips?
As people have mentioned, you can use the Chrome Developer Tools to profile memory usage.
For CPU and RAM, it's not particularily scientific, but you could get a broad gauge by having no applications open other than Chrome which has about:blank open and your OS' Activity Monitor or Task Manager.
Look at the CPU and RAM readings for Chrome on about:blank, which is about as idle as it will get - then compare that to the readings when your Application is running.
Disable all extensions too, to take them out of the equation.
Hope this helps.

Why is navigator.cpuClass incorrect?

I am trying to acquire the CPU type of visitors from Javascript using navigator.cpuClass in order to offer them the correct download. In my tests I have run into an example of navigator.cpuClass returning "Win32" when expect "Win64". The systeminfo utility on my PC returns:
Intel64 Family 6 Model 15 Stepping 11 GenuineIntel ~2400 Mhz (Q6600) which is further described at:
http://ark.intel.com/Product.aspx?id=29765
Can anyone tell me why Javascript is not seeing a 64 bit CPU? I need to reliably detect that CPU...
Perhaps you are using a 32 bit browser. Trying out the samples from here, I get the same results (Win32) even though I'm running a 64 bit OS (with a 32 bit build of Chrome).
However, in my case, Chrome's appVersion string indicates that it runs under the Wow64 emulation layer. Perhaps you can find such hints for others browsers as well.
Generally, you can't detect the CPU class reliably because you never know whether your browser took the red or the blue pill.
A pragmatic solution would be to offer a default choice based on what your browser returns, and allow the user to switch to a 64 bit version. Since most 32 bit software runs flawlessly in a 64 bit environment (as proved by this case), most users won't notice if they pick the 'wrong' download.

How does any application (chrome, flash, etc) get a time resolution better than the system time resolution?

This article on Microsoft's tech net site supplies an exe that will calculate your windows machine's minimum time resolution - this should be the smallest "tick" available to any application on that machine:
http://technet.microsoft.com/en-us/sysinternals/bb897568.aspx
The result of running this app on my current box is 15.625 ms. I have also run tests against Internet Explorer and gotten the exact same resolution from the Date() javascript function.
What is confusing is that the SAME test I ran against IE gives back much finer resolution for Google's Chrome browser (resolution of 1ms) and for a flash movie running in IE (1ms). Can anyone explain how any application can get a clock resolution better then the machine's clock? If so, is there some way I can get a consistently better resolution in browsers other then Chrome (without using flash)?
The first answer below leads to two other questions:
How does a multi-media timer get
times between system clock ticks. I
imagine the system clock as an
analog watch with a ticking hand,
each tick being 15ms. How are times
between ticks measured?
Are multimedia timers available to
browsers, especially Internet
Explorer? Can I access one with C#
or Javascript without having to push
software to a user's
browser/machine?
You can get down to 1 ms with multimedia timers and even further with QueryPerformanceCounter.
See also GetLocalTime() API time resolution.
EDIT: Partial answer to the new subquestion ...
System time resolution was around 15 ms on the Windows 3 and 95 architecture. On NT (and successors) you can get better resolution from the hardware abstraction layer (HAL). The QueryPerformanceCounter counts elapsed time, not CPU cycles article, written by the Raymond Chen, may give you some additional insights.
As for the browsers - I have no idea what they are using for timers and how they interact with the OS.
Look at the timeBeginPeriod API. From MSDN: "This function affects a global Windows setting. Windows uses the lowest value (that is, highest resolution) requested by any process."
http://msdn.microsoft.com/en-us/library/ms713413(VS.85).aspx
(Markdown didn't like parens in the URL)
See "Inside Windows NT High Resolution Timers" referenced from the link you posted.
The APIC on the processor runs at bus speed and has a timer. They may be using that instead of the system time. (Or they might just be giving a bunch of precision that isn't there.)
This description of the Local APIC mentions using it as a timer.
(It may also be the case that there is some performance counter they are using. That actually seems more likely since a device driver would be needed to program the APIC.)

Categories

Resources