English 中文(简体)
j 移动和谷歌地图
原标题:jQuery Mobile and Google Maps API v3 memory leak

我拥有一个移动式网络,使用j Query 移动电话1和谷歌地图AP 诉3。 在将谷歌地图装在“移动式”内时,似乎出现了重大记忆泄漏。 谷歌地图的记忆在用户离开地图页时没有公布。 因此,当用户返回地图页时,记忆使用量在不断增加。 这在移动网络浏览器上是一个特别大的问题。 我在 Android台上测试如下文。 泄漏可以如下:

纳比特:

Click "View Course" and let the map load fully. Then click the browser back button or the back button on the lower left corner. Reclick "View Course" and let the map load fully. Repeat. On every map load you see about 30MB added to the process of Chrome or the mobile browser.

我如何确定这一点? 我找不到一张地图短片。

感谢

尼克

问题回答

我认为,你正在呼吁创造美好生活 每一次绘制地图,而不是检查地图是否已经存在和重新使用物体。

类似情况:

var mapDisplay = {                                                                                                                                                               
    mapCreated : false,
    init: function() {
      //some init stuff
    },
    showMap: function() {
        if(!mapDisplay.mapCreated) {
            mapDisplay._createMap();
            mapDisplay.mapCreated = true;
        }
        $("#my_map").show();
        $( #my_map ).gmap( refresh );                                                                                                                                  
    },
    _createMap : function() { 
        //options would be a json config object
        $( #my_map ).gmap(options);
    },
    //all the other methods you need
}

https://github.com/libbybaldwin/GMap-Demo-App” rel=“nofollow”





相关问题
Weak event handler model for use with lambdas

OK, so this is more of an answer than a question, but after asking this question, and pulling together the various bits from Dustin Campbell, Egor, and also one last tip from the IObservable/Rx/...

JavaScript memory problem with canvas

I m using getImageData/putImageData on a HTML5 canvas to be able to manipulate a picture. My problem is that the browser never seems to free any memory. Not until I close the tab (tested in Chrome and ...

Memory leak for CComBSTR

I have read that the following code causes memory leak. But did not understand why. CComBSTR str; pFoo->get_Bar(&str); pFoo->get_Baf(&str); How does it cause a leak when we are not ...

Hunting memory leaks

I m finding leaked heap blocks by using the following command in WinDbg !heap –l With each leaked heap block I get, I m running to following to get the stack trace. !heap -p -a leakedheapblock The ...

NSScanner memory leak

I m at my first experiences with iPhone development. I wrote some basic code to test the NSScanner class, and now I was looking into the Leaks tool. It seems that this code is leaking, when in the ...

Do Small Memory Leaks Matter Anymore?

With RAM typically in the Gigabytes on all PC s now, should I be spending time hunting down all the small (non-growing) memory leaks that may be in my program? I m talking about those holes that may ...

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

热门标签