This is a migrated thread and some comments may be shown as answers.

memory warnings

20 Answers 161 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
peter
Top achievements
Rank 1
peter asked on 12 Nov 2012, 11:21 AM
HI!
I have the following

/// gets the data from the webserver
 GetAllData = function (url, callback, additionParamString){
   var dataSource = new kendo.data.DataSource({
                        transport: {
                            read: {
                                // the remote service url
                                url: url +'&JsonCallback=?',
                                // JSONP is required for cross-domain AJAX
                                dataType: "jsonp",
                                // additional parameters sent to the remote service
                                data: {
                                    q: "html5"
                                }
                            }
                        }
                    });

   return dataSource;

}

function ShowDirectoryForCategory(e){
  var category = e.view.params.id;
  var url = URL_Directory_ROOT +'&category='+category;

   e.view.element.find("#uxDirectoryList").kendoMobileListView({
            template: kendo.template($("#templateForDirectoryListingItem").html()),
            dataSource:GetAllData( url,null,'')
    });  
}

sometimes when calling ShowDirectoryForCategory it crashes the app (I am using xCode via phoneGap 2....) - this is only on a device - if I have it connected I get a memory warning ...
should I be  clearing the data somehow... ?? sometimes there is a "lot" of data there times not..  is there a limit on the size of data transfered>>??

and

20 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 13 Nov 2012, 05:37 PM
Hello Peter,

 We are not really sure how often the ShowDirectoryForCategory method is called. However it is not a good idea to initialize a kendo widget more than once.

 I suggest you initialize your listview only once. Modify the datasource configuration so the url setting is a function:

ransport: {
     read: {
         url: function() {
                 var url = getUrlForCurrentCategory(); // you need to implement this function based on your requirements - current category etc.
               
                return url;
         },
         dataType: "jsonp"
      }
}

If you need further assistance please attach a sample project which we can check.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 14 Nov 2012, 11:44 AM
thanks
so how do I stop initializing the listview.
0
Atanas Korchev
Telerik team
answered on 14 Nov 2012, 12:58 PM
Hello Peter,

 You shouldn't stop initializing the list view. You should initialize it only once.

 If you need further assistance please attach a sample project which we can check.
 
Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 14 Nov 2012, 02:53 PM
hi
thanks
attached is a cobble together of the code.
please see the index.html page and the assets/js/FuzzelogicSolutionsTreetoFramework.js files
the main methods in the js files are

function ShowDirectoryForCategory(e)
function ShowMainMenu (e) 

with datasources around line 105.

I want to maximise the reuse - SO I don't want to create a new ds for everything.

0
Atanas Korchev
Telerik team
answered on 14 Nov 2012, 04:04 PM
Hi Peter,

 You can try using the init event of the view instead of show. That way the ShowMainMenu method will be executed only once. Here is a code snippet:

<div id="pgHome"
data-role="view" data-layout="layout-Main"
data-init="ShowMainMenu"
data-title="Home">

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 14 Nov 2012, 05:00 PM
hi
thnx
but if its executed once - it won't be able to dynamically build the menu when it changes on the server. ?
also when I do - the menu shows, but the categories fail.
0
Atanas Korchev
Telerik team
answered on 15 Nov 2012, 08:17 AM
Hi,

 We are not really sure what your business requirements are and how your application should behave. For example we don't really know what "it won't be able to dynamically build the menu when it changes on the server. ?" means. Some explanation how this "menu" is built from the "server" are needed.

All in all you should try not to initialize the ListView more than once. I've shown one way to do so via the init event. 

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 19 Nov 2012, 03:23 AM
hi
It seems that it cannot handle the amount of data returned from > 

http://treetolocal.fuzzelogicsolutionslabs.im/mobileapi/getdirectorylistingsfor?local=iom&category=Restaurants&JsonCallback=jQuery1710935744249029085_1352669252906&_=1352669276206
This crashes an ios App - simulator is fine, web is fine......

this sucks and this is going to be a deal breaker for me if kendo cannot load this data. I say Kendo cos I have an old version of this built using MonoTouch and it loads this data no problems

Thanks

0
Atanas Korchev
Telerik team
answered on 19 Nov 2012, 07:55 AM
Hello Peter,

 I tried to recreate the problem but making a request to http://treetolocal.fuzzelogicsolutionslabs.im/mobileapi/getdirectorylistingsfor?local=iom&JsonCallback=jQuery17205324998481664807_1353311467125 returned an exception (actual browser screen is attached as a screenshot). Can you provide a working JSONP endpoint which we can test with?

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 19 Nov 2012, 05:11 PM
HI
Thank you - I am REALLY REALLY sorry.. must be too late 
here's the correct link it was missing the category
http://treetolocal.fuzzelogicsolutionslabs.im/mobileapi/getdirectorylistingsfor?local=iom&JsonCallback=jQuery17205324998481664807_1353311467125&category=Restaurants



you can try category=Taxi
and category=ITServices

Hope this help
PLease remember this issue is from ios device only built using phonegap

Thank you again.
0
Atanas Korchev
Telerik team
answered on 20 Nov 2012, 07:39 AM
Hi Peter,

 I created a live demo using your data: http://jsbin.com/iburuy/1/edit. You can check just the demo here: http://jsbin.com/iburuy/1

 I tested it on iPhone 4 and iPad 3 and everything worked as expected.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 20 Nov 2012, 11:30 AM
Hi
Thanks - 
that is very very similar to what I have - 
the issue is when I do a data-show  - when the category changes from Restaurant to say Taxi .. 
0
Atanas Korchev
Telerik team
answered on 20 Nov 2012, 11:54 AM
Hi Peter,

 Please modify the example so it mimics your scenario. We cannot really help without reproducing the problem first.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 20 Nov 2012, 12:15 PM
thanks
I've tried to update the sample - > http://jsbin.com/iburuy/3/edit
but as you see I have no way of refreshing the data source. 

0
Atanas Korchev
Telerik team
answered on 20 Nov 2012, 12:51 PM
Hi Peter,

Thanks for updating the sample. I think I now understand what you are trying to achieve.

In this case it is best to use the read method of the data source to set the new category. The initial category is specified from the data setting of transport.read

Here is the updated example: http://jsbin.com/iburuy/7/edit

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 20 Nov 2012, 02:43 PM
HI
I will try this on the device - fingers crossed it will work and not cause a app shut down - thank you for your patience :)

0
peter
Top achievements
Rank 1
answered on 20 Nov 2012, 03:00 PM
hi
just tried it, and got ...

2012-11-20 14:58:38.565 treetoLocal[5930:707] Multi-tasking -> Device: YES, App: YES

2012-11-20 14:59:34.695 treetoLocal[5930:707] Received memory warning.

2012-11-20 14:59:36.534 treetoLocal[5930:707] Received memory warning.

then it closed the app..  :(
0
Atanas Korchev
Telerik team
answered on 20 Nov 2012, 03:18 PM
Hello Peter,

 This example has been tested on various iOS devices (by navigating with Safari to http://jsbin.com/iburuy/7). No memory errors were observed. How do you deploy this example? What are the required steps to reproduce this locally?

All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
peter
Top achievements
Rank 1
answered on 20 Nov 2012, 03:31 PM
hi this is built using phoneGap 2.1 and deployed using xCode to build to device. 
if you give me an email address - I can email you the complete project - prefer not to put in on here .
0
Atanas Korchev
Telerik team
answered on 20 Nov 2012, 03:43 PM
Hi Peter,

 We just tested in a phonegap project as well. Still everything worked as expected (both in the simulator and on an iphone 4 device). Find attached our xcode project as well as a recording showing how things work at our end. Does the attached project work at your side?

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
peter
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
peter
Top achievements
Rank 1
Share this question
or