Summary: | JavaScriptCore Garbage Collector Issue | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | maxh <maxh> | ||||
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | NEW --- | ||||||
Severity: | Major | CC: | ggaren, saam | ||||
Priority: | P2 | ||||||
Version: | 420+ | ||||||
Hardware: | iPhone / iPad | ||||||
OS: | iOS 8.2 | ||||||
Attachments: |
|
Description
maxh
2015-05-28 04:43:51 PDT
Created attachment 253842 [details]
iOS project with reproduced bug
So I've tried some different tests with repeating calls from Swift to JS but the freeze keeps coming up. Any ideas on this? Hi, I gathered some citations for my bachelor thesis and I read the JavaScriptCore WebKit page again and noticed the section about the three kinds of JIT compilers for JavaScriptCore. Is it possible that in my tests the baseline JIT tries to handle everything and the dfg JIT is not taking over? Or am I misunderstanding that part? Am I able to manually access the different JITs or is this handled automatically? Thanks. Max Hi Max, I can maybe take a closer look when I'm not on vacation (I'm on my phone now) but I have a question: Are you initializing a new VM in every loop iteration? It sounds like you may be misinterpreting what's happening with the JITs. The JITs should "Just Work" as if everything were just run through an Interpreter without any intervention on your part. Tiering up from the baseline JIT to the DFG is handled automatically and you don't have to think about that. Hi Saam, thanks for looking into this. In my tests I have to loops, one for the number of test runs (let's say 20) and the inner loop that takes a single test from an array (an array may contain up to 255 values for one test), which then calls the function for the JavaScriptCore implementation. So yes, every time I run one test in the inner loop a new JSVirtualMachine() and a new JSContext(virtualMachine) object will be created. Should I just keep on JSVirtualMachine alive all the time and create new JSContext's instead? By the way, I need to say that I also had the issue before I manually initialized the JSVirtualMachine but only the JSContext. But I guess that if I don't manually initialize the VM it will automatically generated with a new JSContext right? If you want to take a quick look at some code, you can use my StackOverflow question: http://stackoverflow.com/questions/30443993/javascriptcore-on-ios-vm-garbage-collector-not-automatically-emtpying Thanks again. So ... yeah ... I found it ... I was initializing a new VM every loop. I got rid of this (opening one single VM on start and be done with it) and everything works fine now. I guess my misconception was that I tried to manually close every VM at the end of each loop, which didn't work. So I guess my last question is: is there a way to manually deinitialize a VM from Swift/Objective-C somehow? I tried a deinitialize(){} but as you know that doesn't work either. Thank you all (especially Saam for pushing me in the right direction), Max |