3

I'm writing a mobile web application using JQuery Mobile, JQuery, Javascript. This is my first run at writing a mobile web application so I'm trying things out. I want the program I'm writing to continuously run in the background so I can't rely on a garbage collector and I'm worried about memory usage on a mobile device. I'm being careful to "null" and "delete" vars and functions when I'm done with them but I'd like a tool or system I can use to measure. I'm using CS5 Web Premium as the platform with which I'm writing my code. So...

Question: How do you test memory usage when bulding mobile web applications?

Thierry Blais
  • 2,848
  • 22
  • 41
  • `I want the program I'm writing to continuously run in the background so I can't rely on a garbage collector ... I'm being careful to "null" and "delete" vars and functions` - sounds like you don't know how GC works. Please explain why you think you can't rely on the GC and show how you use `null` and `delete` to improve on that. –  Nov 30 '11 at 15:37
  • Sorry I should have said I want to help the GC as much as possible...I have two functions to start, one runs itself evey minute, so essentially it end in: 'setTimeout(myFunction, 60000);' Because I want this function to pop an alert at the start of the minute I have another function that checks for the start of the minute every second, it goes something like 'if (start of minute) {myFunction} else {setTimeout(initmyFunction, 1000);}' When an alert pops it stops all browser function so I have to reset the timing with my initmyFunction. It's circular, I want to manage it as best I can. – Thierry Blais Nov 30 '11 at 17:03
  • Can you recommend any good online reads about how garbage collector actually works? – Thierry Blais Nov 30 '11 at 17:11
  • I don't think a web site/app can work continuously in the background. Afaik, once browser window out of focus all the scripts and animations stopped on almost all modern mobile OSes. (is pl. of OS OSes :) – nLL Dec 01 '11 at 21:34

2 Answers2

2

The easiest would be to type about:memory in your GoogleChrome browser and watch the memory usage there.....

You could also use something like DynaTrace to get more details per jscript function (execution times and so on)

Leon
  • 4,532
  • 1
  • 19
  • 24
1

The Mobile validator of the W3C http://validator.w3.org/mobile/ Should tell you what size your site is. (How much memory it takes to load) That is if your application is HTML.

Fredy31
  • 2,660
  • 6
  • 29
  • 54