I would suggest that you save the data into a file. and then, send a post request with a FileEntity/InputStreamEntity. I have used it with HttpClient and it works fine. You would be relieved of all the manual work in this case,
-Kumar Bibek http://techdroid.kbeanie.com On Sep 23, 10:44 pm, Paweł Zięba <[email protected]> wrote: > Do you really need a such big array allocated in memory? > Maybe you want to save it to file or database? > If so, you don't need to create the huge array. > Just try to redirect stream. > > On 23 Wrz, 17:54, TheSeeker <[email protected]> wrote: > > > I have reduced lenght of byte to 250 000 (byte[] array = new > > byte[250000] instead of char huge char[] array = new char[900000] ) > > > I've been trying sending string instead of character by character. if > > string is big (250 000 characters aprox and 250 Kbytes) de Garbage > > collector go crazy and the time spend is too much (more than 2 min and > > it is funny). Then i do other experiment, split the string in a lot of > > little string of lenght of 1024 bytes and 256 bytes. The conclusion is > > if string is huge the time is infinite and CG produce the spend of > > time, and when the string is small 256bytes GC seem to do not produce > > the problem. In the extreme case when i send byte by byte (Log posted > > above) is the best case > > > In the original problem is the best case, because GC spent 1,2 seg(150 > > ms*8) aprox but my chronometer in my hand said 15 seg. > > > This is rare for me because if i send byte by byte i will be sending a > > header of TCP/IP about 40bytes. If i send byte by byte i will be > > sending 40*(1Mbytes of info) = 40Mbyes and it work better than send > > 1Mbyte in a string > > > On Sep 10, 12:53 am, Miguel Morales <[email protected]> wrote: > > > > No, breaking it into two arrays will not help you. > > > I haven't done this myself, but I THINK what you'll want to do is use > > > a BufferedWriter or something similar. In any case, you'll HAVE to > > > buffer your data and send it in chunks. HTTP supports this quite > > > well. Take a look at some BufferedWriter tutorials, or perhaps > > > someone can suggest a better approach. > > > > On Thu, Sep 9, 2010 at 9:41 PM, TheSeeker <[email protected]> > > > wrote: > > > > yes, i had a mismach, thanks. But i still have the same problem with > > > > time(1 min ) and GC. Create 2 or more array instead of the big one > > > > will solve the problem with time? > > > > > On Sep 8, 5:47 pm, Frank Weiss <[email protected]> wrote: > > > >> Looks bad, very bad. > > > > >> First, I have no idea why you're allocating 1.8 MB (remember that > > > >> Java, and > > > >> I suppsoe Dalvik as well, takes 16 bits per char). How come so much? > > > >> Second, > > > >> of course writing a byte (or is it a char, there's a mismatch there) is > > > >> going to be slower than writing at least a few thousand at a time. > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Android Developers" group. > > > > To post to this group, send email to [email protected] > > > > To unsubscribe from this group, send email to > > > > [email protected] > > > > For more options, visit this group at > > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > > ~ Jeremiah:9:23-24 > > > Android 2D > > > MMORPG:http://developingthedream.blogspot.com/,http://diastrofunk.com,http:/... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

