S SinanTasgin Member Licensed User Longtime User Dec 11, 2015 #1 Hi , I have an issue about web services which i require your assistance. The device is working properly when i create an xmlString which has between 300-500 records in it. But when it gets over 500 records (eg 1400) I replace my xmlString with a for loop. But unfotunately this makes the device pause and it terminates. I have the same issue when I run the program in debug mode and also in release mode. The program runs the for loop for max 500 records but it terminates itself when records gets over 500. So I will be so grateful if you come up with an advice and help me out with this problem.
Hi , I have an issue about web services which i require your assistance. The device is working properly when i create an xmlString which has between 300-500 records in it. But when it gets over 500 records (eg 1400) I replace my xmlString with a for loop. But unfotunately this makes the device pause and it terminates. I have the same issue when I run the program in debug mode and also in release mode. The program runs the for loop for max 500 records but it terminates itself when records gets over 500. So I will be so grateful if you come up with an advice and help me out with this problem.
DonManfred Expert Licensed User Longtime User Dec 11, 2015 #2 see the log for errors. There MUST be some who tells what´s wrong if the app just quits... Upvote 0
S SinanTasgin Member Licensed User Longtime User Dec 14, 2015 #3 I can't see in log . For loop is not finished . Cursor2.RowCount = 1008 The sayac (counter ) is between 400 to 500 on average . XML string for the overload hangs. The loop should continue, however, the program is not going to happen. Last edited: Dec 14, 2015 Upvote 0
I can't see in log . For loop is not finished . Cursor2.RowCount = 1008 The sayac (counter ) is between 400 to 500 on average . XML string for the overload hangs. The loop should continue, however, the program is not going to happen.
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2015 #4 Does it happen in Release mode as well? Upvote 0
LucaMs Expert Licensed User Longtime User Dec 14, 2015 #5 Can be this the problem? Erel said: You shouldn't block the main thread Click to expand... Use a Service? [I know Erel does not agree, but... try adding a DoEvents inside the loop ] Upvote 0
Can be this the problem? Erel said: You shouldn't block the main thread Click to expand... Use a Service? [I know Erel does not agree, but... try adding a DoEvents inside the loop ]
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2015 #6 Note that using a service will not help. Service code runs on the main thread as well. Upvote 0
S SinanTasgin Member Licensed User Longtime User Dec 14, 2015 #7 Erel said: Does it happen in Release mode as well? Click to expand... Yes , I 'm having the same problem. Upvote 0
Erel said: Does it happen in Release mode as well? Click to expand... Yes , I 'm having the same problem.
LucaMs Expert Licensed User Longtime User Dec 14, 2015 #8 Erel said: Note that using a service will not help. Service code runs on the main thread as well. Click to expand... Yes, I thought about this after. Eventually, a new thread. Anyway, given that adding a DoEvents takes 1 sec, I would try Upvote 0
Erel said: Note that using a service will not help. Service code runs on the main thread as well. Click to expand... Yes, I thought about this after. Eventually, a new thread. Anyway, given that adding a DoEvents takes 1 sec, I would try
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2015 #9 The way to solve such issues is to add some log messages and find out where it hangs or takes too long to complete. If you are dealing with large strings then you should use StringBuilder instead of String. Upvote 0
The way to solve such issues is to add some log messages and find out where it hangs or takes too long to complete. If you are dealing with large strings then you should use StringBuilder instead of String.
S SinanTasgin Member Licensed User Longtime User Dec 14, 2015 #10 As shown in the photo section of the <details> to produce 1008 units. Is it a problem XML string of overload ? Last edited: Dec 16, 2015 Upvote 0
As shown in the photo section of the <details> to produce 1008 units. Is it a problem XML string of overload ?
LucaMs Expert Licensed User Longtime User Dec 14, 2015 #11 Erel said: The way to solve such issues is to Click to expand... ... send the project to Erel Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 14, 2015 #12 The correct way to build large strings is with a StringBuilder. We cannot really say to much without going over your code. As I said before you should add some log messages to understand what slows down. Upvote 0
The correct way to build large strings is with a StringBuilder. We cannot really say to much without going over your code. As I said before you should add some log messages to understand what slows down.
KMatle Expert Licensed User Longtime User Dec 14, 2015 #13 I would write the xml to a FILE instead of using a string... My opinion: Keeping huge data structures in memory is a programming mistake (>1000 units -> bad). For this we have files or databases. XML is nice (I use it a lot) but keep an eye on the data/overhead ratio (does it make sense to store 4 bytes in a structure which needs 50 to keep it?) Upvote 0
I would write the xml to a FILE instead of using a string... My opinion: Keeping huge data structures in memory is a programming mistake (>1000 units -> bad). For this we have files or databases. XML is nice (I use it a lot) but keep an eye on the data/overhead ratio (does it make sense to store 4 bytes in a structure which needs 50 to keep it?)
S SinanTasgin Member Licensed User Longtime User Dec 18, 2015 #14 Use StringBuilder instead of string expression in the program performance has increased. The main thing that solves my problem also I had to add SetApplicationAttribute(android:largeHeap,"true") to the manifest editor. Thank you to everyone. https://www.b4x.com/android/forum/t...-to-check-memory-available.58925/#post-371102 Upvote 0
Use StringBuilder instead of string expression in the program performance has increased. The main thing that solves my problem also I had to add SetApplicationAttribute(android:largeHeap,"true") to the manifest editor. Thank you to everyone. https://www.b4x.com/android/forum/t...-to-check-memory-available.58925/#post-371102