Tool/software:
Hi,
[background]
- TI SDK version: 8.2, QNX
- The Question is related with TIOVX and shared memory allocator.
We have got an issue which is hard to reproduce (<5%): the pipeline of surround camera view has encountered a memory failure, which resulted in a black screen issue from vehicle market. details:
From app log, we can see the return value was(-8)VX_ERROR_NO_MEMORY) when TIOVX API vxVerifyGraph was called but no any other available log(vx_print of TIOVX has been disabled)
The internal process of vxVerifyGraph mainly apply necessary shared memory for pipelining.
But no any error slog, just some initiated log like:
"Jan 01 08:00:00.212 shmemallocator.73741 SharedMemoryAllocator: BaseAddress: 0xb8000000 Size: 0x2a000000 (704643072)"
[question]
../vision_apps/utils/mem/src/app_mem_qnx.c
void *appMemAlloc(uint32_t block, uint32_t size, uint32_t align)
int32_t appMemFree(uint32_t block, void *virtPtr, uint32_t size )
We've now found there seems to be a possible reason from app_mem_qnx.c
appMemAlloc and appMemFree, both of reference a global variable of bufs[i], but there is no safe protection for bufs, that means appMemAlloc is not thread safe when multi-thread running for memory.
At least it may cause a memory leak issue, but we cannot sure whether it can result in a null (virtual) address to apps when call appMemAlloc.
We have created more timer threads to test it. In each thread, there is a loop: call appMemAlloc for 10K memory, sleep 10ms then call appMemFree. A null address returned from appMemAlloc occasionally.
So it seems to be a real reason.
Please check whether there is an issue in appMemAlloc.
Thank you.