Photon Listening mode

When _sbrk is not found this means that there is some function (most likely a C-library function) that is trying to allocate memory, but isn’t using malloc.

Here’s how to find out which function is causing the problem:

  • add a function extern "C" void* _sbrk() { return NULL; } to your program. This is only temporary and will fill in the missing function so the code links.
  • open the user-part.lst file that is produced alongside your compiled application code
  • search for _sbrk to find which function is calling that. (It’s usually _malloc_r)
  • then search for _malloc_r and see which function is calling that. That will tell you which function is trying to allocate memory directly via _malloc_r rather than via malloc()

Another approach, a little less direct, is to systematically remove pieces of your code until the program compiles, including/excluding pieces until you narrow down the exact line of code.

Once you find out which function is causing the linker error, please let me know and I’ll investigate how we can fix things.

Thanks :slight_smile:

4 Likes