R rspitzer Active Member Apr 24, 2020 #1 Somehow I screwed something up. After initializing the async stream for serial port communications (see code below) the debugger immediately throws the following fatal error: Program started. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc when it executes the astream.Initialize Code: Copy sp.Initialize("sp") serial_port_name=sp.ListPorts.Get(0) sp.Open(serial_port_name) sp.SetParams(sp.BAUDRATE_9600, sp.DATABITS_8, sp.STOPBITS_1, sp.PARITY_SPACE) astream.Initialize(sp.GetInputStream, sp.GetOutputStream, "astream") I do not know why this is all of the sudden happening? It was working. Is there a method to debug this? From some generic web searching, the error seems to be related to memory allocation? Don't know why this has occurred. On my laptop, I get openjdk error, and on the raspberry pi I am running this on I get the above error.
Somehow I screwed something up. After initializing the async stream for serial port communications (see code below) the debugger immediately throws the following fatal error: Program started. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc when it executes the astream.Initialize Code: Copy sp.Initialize("sp") serial_port_name=sp.ListPorts.Get(0) sp.Open(serial_port_name) sp.SetParams(sp.BAUDRATE_9600, sp.DATABITS_8, sp.STOPBITS_1, sp.PARITY_SPACE) astream.Initialize(sp.GetInputStream, sp.GetOutputStream, "astream") I do not know why this is all of the sudden happening? It was working. Is there a method to debug this? From some generic web searching, the error seems to be related to memory allocation? Don't know why this has occurred. On my laptop, I get openjdk error, and on the raspberry pi I am running this on I get the above error.
Erel B4X founder Staff member Licensed User Longtime User Apr 26, 2020 #2 Terms are important. There is no such thing as "async". The correct term is AsyncStreams. However this error is not related to AsyncStreams at all. It is related to jSerial. Are you using the latest version of jSerial? Upvote 0
Terms are important. There is no such thing as "async". The correct term is AsyncStreams. However this error is not related to AsyncStreams at all. It is related to jSerial. Are you using the latest version of jSerial?
R rspitzer Active Member Apr 26, 2020 #3 You are right of course, sorry about the grammar. The problem generated was my stupid coding problem. I assumed the serial port I was trying to open was at the "Get(0)" and was not doing a proper search through the list to find the proper name. I was lucky, that the system mapped the serial port to "Get(0)" and not lower in the "Listports", well my luck ran out. I put a proper search in the code, and it turns out it is now at "Get(2)". Now its working fine. My dumb mistake. I should not take things for granted. Upvote 0
You are right of course, sorry about the grammar. The problem generated was my stupid coding problem. I assumed the serial port I was trying to open was at the "Get(0)" and was not doing a proper search through the list to find the proper name. I was lucky, that the system mapped the serial port to "Get(0)" and not lower in the "Listports", well my luck ran out. I put a proper search in the code, and it turns out it is now at "Get(2)". Now its working fine. My dumb mistake. I should not take things for granted.