techknight Well-Known Member Licensed User Longtime User Oct 3, 2018 #1 I keep getting a crash of this: B4X: terminate called after throwing an instance of 'std::bad_alloc' Sometimes after opening or closing the serial port. Sometimes if the serial port is open, I do a send, then I do Astream.close, and Serial1.close, the app crashes with that error. I cant seem to solve it. Any ideas?
I keep getting a crash of this: B4X: terminate called after throwing an instance of 'std::bad_alloc' Sometimes after opening or closing the serial port. Sometimes if the serial port is open, I do a send, then I do Astream.close, and Serial1.close, the app crashes with that error. I cant seem to solve it. Any ideas?
Erel B4X founder Staff member Licensed User Longtime User Oct 4, 2018 #2 This is a low level error. Which port are you opening? Similar error reported here: https://www.b4x.com/android/forum/threads/rpi3-and-std-bad_alloc.65974/ Upvote 0
This is a low level error. Which port are you opening? Similar error reported here: https://www.b4x.com/android/forum/threads/rpi3-and-std-bad_alloc.65974/
techknight Well-Known Member Licensed User Longtime User Oct 4, 2018 #3 ttyUSB0 is what I am using. its connected to an FTDI xBee explorer board. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Oct 4, 2018 #4 techknight said: I do Astream.close, and Serial1.close, the app crashes with that error. Click to expand... 1. Use Sleep to wait a second or two after you send the data and before you close the serial port. 2. Consider keeping the serial open until your app terminates. Upvote 0
techknight said: I do Astream.close, and Serial1.close, the app crashes with that error. Click to expand... 1. Use Sleep to wait a second or two after you send the data and before you close the serial port. 2. Consider keeping the serial open until your app terminates.
techknight Well-Known Member Licensed User Longtime User Oct 4, 2018 #5 Well its a Kiosk type thing so if the app terminates itll be because of a power loss or etc... So, I think I will keep the serial port open. Upvote 0
Well its a Kiosk type thing so if the app terminates itll be because of a power loss or etc... So, I think I will keep the serial port open.
Erel B4X founder Staff member Licensed User Longtime User Oct 4, 2018 #6 If it is expected to run 24/7 then create another non-ui app that checks whether the main app is running and starts it if it is not running. Upvote 0
If it is expected to run 24/7 then create another non-ui app that checks whether the main app is running and starts it if it is not running.