Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 9 Monaten, 2 Wochen
Letzter Beitrag:
vor 9 Monaten, 1 Woche
Beteiligte Autoren:
Luis Antonio Gutiérrez Flores, Ruben Sanchez Peña

[WM 20] java.lang.outofmemoryerror while downloading files

Startbeitrag von Luis Antonio Gutiérrez Flores am 06.04.2017 15:30

Good morning! Anyone had received the "java.lang.outofmemoryerror" on Windev Mobile? My android application crashes and throws this error while downloading files, the file in which it crashes has a size of about 32MB, the weird thing here is the following: After it crashes, the app restarts, if you go to the download option again and try to download the same file, it will work just fine. So I don't have any idea as how to fix this issue :/ My code is the following:

PROGBAR_ProgBar1..Visible = True
LOOP_Descargas..State = Grayed
PROGBAR_ProgBar1 = 0
HTTPProgressBar(PROGBAR_ProgBar1)
bCorrecto is boolean = HTTPRequest(sRuta)

bufZip is Buffer
IF bCorrecto = True THEN
bufZip = HTTPGetResult(httpResult)
END

HTTPProgressBar("")
PROGBAR_ProgBar1..Visible = False
LOOP_Descargas..State = Active

Antworten:

Fixed it, set my buffer variable in which I stored my file to a fixed buffer giving it a certain size and it prevented the app from throwing the error

von Luis Antonio Gutiérrez Flores - am 06.04.2017 17:27
Hi. You can use HTTPDestination to store the file to "disk" and avoid use memory buffer.

Rubén

von Ruben Sanchez Peña - am 06.04.2017 20:31
Thanks! Yes I started using HTTPDestination instead of buffer because doing a double check, I didn't solve the problem it still happens :( Can you tell me if this code is correct?

PROGBAR_ProgBar1..Visible = True
LOOP_Descargas..State = Grayed
PROGBAR_ProgBar1 = 0
HTTPProgressBar(PROGBAR_ProgBar1)
sRutaDescargaTemporal is string = gsRutaDescargaTemporal+stRevMem.nREV_NUM_CTRL+"/"+sNombreZip
HTTPDestination(sRutaDescargaTemporal)
bCorrecto is boolean = HTTPRequest(sRuta)

//bufZipAuto is buffer

HTTPProgressBar("")
PROGBAR_ProgBar1..Visible = False
LOOP_Descargas..State = Active

von Luis Antonio Gutiérrez Flores - am 07.04.2017 14:56
Thanks! Yes I started using HTTPDestination instead of buffer because doing a double check, I didn't solve the problem it still happens :( Can you tell me if this code is correct?

PROGBAR_ProgBar1..Visible = True
LOOP_Descargas..State = Grayed
PROGBAR_ProgBar1 = 0
HTTPProgressBar(PROGBAR_ProgBar1)
sRutaDescargaTemporal is string = gsRutaDescargaTemporal+stRevMem.nREV_NUM_CTRL+"/"+sNombreZip
HTTPDestination(sRutaDescargaTemporal)
bCorrecto is boolean = HTTPRequest(sRuta)
HTTPProgressBar("")
PROGBAR_ProgBar1..Visible = False
LOOP_Descargas..State = Active

von Luis Antonio Gutiérrez Flores - am 07.04.2017 14:56
Hi. Yes, it looks correct.

Maybe you could add to the App Manifest the parameter:

android:largeheap with value true

This allow use additional memory for your app.

Rubén

von Ruben Sanchez Peña - am 07.04.2017 19:22
Thanks for your help! It did work with HTTPDestination! :D

von Luis Antonio Gutiérrez Flores - am 12.04.2017 14:47
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.