admin管理员组文章数量:1320864
This is the fiddle: /
After about 10-20 seconds, the display starts to freeze randomly and shortly after crashes. I cannot reproduce this in Firefox.
Profiling reveals nothing unusual.
/ shows there is definitely a memory leak. Even a 1 FPS, the memory usage climes 5 megabytes a frame.
On a side note, this example really shows how Math.random() is really not so random.
This is the fiddle: http://jsfiddle/36mdt/
After about 10-20 seconds, the display starts to freeze randomly and shortly after crashes. I cannot reproduce this in Firefox.
Profiling reveals nothing unusual.
http://jsfiddle/3pbdQ/ shows there is definitely a memory leak. Even a 1 FPS, the memory usage climes 5 megabytes a frame.
On a side note, this example really shows how Math.random() is really not so random.
Share Improve this question edited Jun 14, 2012 at 16:19 trumank asked Jun 14, 2012 at 15:48 trumanktrumank 2,7943 gold badges23 silver badges31 bronze badges 15- 3 I don't have an answer yet, but that visual effect is freaking AWESOME... :) – chrisfrancis27 Commented Jun 14, 2012 at 15:52
-
4
Did you notice that after 10 seconds, it's using
1.2GB
of memory – Esailija Commented Jun 14, 2012 at 15:52 - @Esailija The task manager shows that, but profiling shows no change...? – trumank Commented Jun 14, 2012 at 15:54
- @MathWizz what do you mean by profiling – Esailija Commented Jun 14, 2012 at 15:54
- @Esailija The "Profiles" tab in the Chrome console. – trumank Commented Jun 14, 2012 at 15:56
3 Answers
Reset to default 3I've done only 2 performance improvements and it doesn't crash after 5 mins (also seems to be not leaking memory). Checkout http://jsfiddle/3pbdQ/3/
- Don't calculate the size inside each iteration
- Use timeouts instead of freezing interval.
- Use bitwise operator for flooring a number
Profiling reveals nothing unusual.
Chrome Profiler doesn't work with WebWorkers, AFAIK. As per conversation with Paul Irish:
"Check about:inspect for shared workers, also you can do console.profile() within the worker code (I THINK) and capture those bits. The "cleans up" is the garbage collector: if after the cleanup there is still a growing line of excess memory, then thats a leak."
And
On a side note, this example really shows how Math.random() is really not so random.
It is well known there are no perfect random algorithms, but anyway the bunch of grouped colors you see is because you're not setting canvas.height and canvas.width, and it differs from CSS values.
EDIT: Still leaking memory, I don't know why, about after 10 secs it 'cleans up'. Exceeds my knowledge, but works smoothly at 60 FPS (var TIME = 16
)
Depending on the system and browser version you use some steps may vary although I tried my best to provide mon steps that are patible with most systems.
Disable Sandbox: 1. Right click Google Chrome desktop icon. 2. Select Properties. 3. Click Shortcut > Target. 4. Add "--no-sandbox" 5. Click Apply | OK. 6. Download and install ZombieSoftFix. 7. Check and resolve conflicts detected.
Disable Plug-Ins: 1. Type "about:plugins" in Address Bar. 2. Press ENTER. 3. Disable all plug-ins displayed in the list page.
Clear Temporary Files: 1. Click Wrench. 2. Select More Tools | Clear browsing data. 3. Check-up all boxes, click "Clear browsing data" button to confirm the process.
Thanks & Regards.
This is an unfortunate, known Chrome bug.
本文标签: JavaScript freezingcrashing in ChromeStack Overflow
版权声明:本文标题:JavaScript freezingcrashing in Chrome - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742004947a2411765.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论