Perhaps it's time to rename the thread into something like : "memory
leak in JavaScriptCore" or something else.
You're right with the delete command. I did not verify it. It is used
to remove only global variables.
All the other variables are deleted as soon as they get out of scope.
I've checked the theory with the caches. But it can't be the reason.
You can load the Widget into Safari and choose "Show Caches Window"
from the "Debug" menu.
I've disabled the WebCore Caches and it still wents up about 1.5 MB
per click.
This is 10 times the size the file should take if it was only the cache.
But on the bottom of the window I've noticed "JavaScript Objects"
When Safari was fresh started by doubly clicking on TestWidget.html
initially the numers are :
interpreters 1 //true, there is just TestWidget.html that runs
JavaScript
no GC 0 //don't know what that means.
referenced 34 //that seems to me like the amount of objects that are
accessible via reference not only my
//variables but also Math String and other generic Objects
total 113 //this seems to be the total amount of created objects
those which were still accessible
//and also those which were left behind and not accessible for
some reason
Anyway, calling the function and hitting the refresh button on the
bottom of the Caches Window tells:
interpreters 1 //still true
no GC 0 //still don't know
referenced 34 //no global variables/objects were created and all the
other have been destroyed as soon as they got out of scope
total 5486 //that amount dramatically increased
I've counted all that stuff and I came to a number near that when I
count ALL if-statements in that function.
I've added counter++; in each for-loop and each if-statement. That
gives me the number of compares.
For those in real if statements and for those in for-loops (since
they compare the variable on each cycle).
Please correct me if I'm wrong. But it realy seems to me like in each
comparation a new object is created
that is then compared against the other stuff. Unlike in C++ or other
languages.
There is nothing to say agains that but why won't the temorary
objects vanish ? :(
Comming back to the Garbage Colletor.
There is a cute big button on the bottom of the Caches Window that
says "Garbace Collect JavaScript Objects".
Sounds great. But does not work at all. After pressing it the Window
tells:
interpreters 1 //still true
no GC 0 //still don't know
referenced 34 //still the same
total 4408 //slightly decreased
I does not collect them all. :(
I've led Safari's memory consumption to 100MB by calling the function
and then pressed the Garbage Collect thing.
The total number decreased from 203739 to 201978. And the memory
consumption stayed right where it was.
For me this seems to be a BIG FAT problem. I could go on.
Imagine :
I could build a page that tells Safari to use all memory and If all
the memory is full to still take more Virtual Memory
slow down the whole system and...
If only someone can tell me that my code is bullshit or something
else I did wrong.
Regards,
Michael
Hi,
I don't know why the memory-usage is going up each time you call
the function. But what I am quite sure of is that your "delete"-
calls are useless. They always return false, but they should return
true if deletion of the variables where successful. It seems that
success is only the case if you define the variables as global
(without the "var"). Of course, that doesn't resolve the main
problem I just wanted to add that.
But another idea that might be worth to think about: As you use
XmlHttpRequest, could it be that whatever you are reading is cached
somehow within the widget, like a webpage? I tried to set the
reqest- header to no-cache but that did not do anything. I don't
know if it would do something if you would use a post-request
instead, though I don't think it will make a difference.
Greetings,
Stephan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden