NVENC session limitations

Hi all,

I am doing H264 encoding using the hardware encoder present in NVIDIA GPUs (NVENC).
I get the correct output but I am unable to launch more than 140 encoding streams.(One stream performs one video encoding)

The error I am getting is “NV_ENC_OUT_OF_MEMORY”.The memory usage for the application when the error happens is much less than total available:
600MB (320X240)
out of 8GB in Quadro M5000).

For bitstream allocation, NV_ENC_CREATE_BITSTREAM_BUFFER has size more than a single frame size and memoryHeap type is CACHED.

Here is the test machine configuration:
Debian Linux 8.5
Intel Xeon E5 @2.60 GHz
Nvidia Quadro M5000
CUDA 7.5, driver 352.39

thanks for your time. Any suggestion/direction to seek solution would be appreciated.