Fix OOM while allocating buffers in the direct memory
Merge pull request #158 from nmusienko/JFG-369

Fix OOM while allocating buffers in the direct memory