B4J Question terminate called after throwing an instance of 'std::bad_alloc'

Discussion in 'B4J Questions' started by sunil thomas, Jan 28, 2018.

  1. sunil thomas

    sunil thomas Member Licensed User

    i used the same code in raspberry pi 2
    in pc it is working fine
    i am getting error while running in raspberry pi 3
    in beginning it was working fine and suddenly start giving error
    i reinstalled raspberry pi but the problem exists
    giving error at
    astream.Initialize(myserial.GetInputStream,myserial.GetOutputStream,"astream")

    output
    Waiting for debugger to connect...
    Program started.
    Started
    1 a
    1 b
    /dev/ttyAMA0
    1 c
    1 d
    terminate called after throwing an instance of 'std::bad_alloc'
    what(): std::bad_alloc

    ************************************************
    Program part

    Sub AppStart (Args() As String)

    Log("Started")
    myserial.Initialize("")
    Log("1 a")
    uart_list = myserial.ListPorts
    Log("1 b")
    myserial.Open(uart_list.Get(0))
    Log(uart_list.Get(0))
    Log("1 c") myserial.SetParams(9600,8,1,0)
    Log("1 d")
    astream.Initialize(myserial.GetInputStream,myserial.GetOutputStream,"astream")
    Log("1 e")
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. sunil thomas

    sunil thomas Member Licensed User

    i tried some other programs and also give the same error in
    astream.Initialize(myserial.GetInputStream,myserial.GetOutputStream,"astream")
    if i changed to
    astream.Initialize(myserial.GetInputStream,NULL,"astream")
    then same error at the next line
    i thing the problem is with the serial lib jserial 1.2
    and my pi 3 is fresh installation and only apache server is running other than b4j-bridge
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It might be as you are getting a low level error. The error happens in the native library.
     
  5. sunil thomas

    sunil thomas Member Licensed User

    thanks

    the erreor is not showing now after
    sudo rpi-update
    i have not tested the communication yet
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice