Issues with jpegenc

I found one oddity encodeFromFd in the function jpeg_write_raw_data (&cinfo, NULL, 0);
I tried to log the start and end of this function with “std::cout”. Afterwards I looked in strace:

strace -o trace_info.txt ./jpeg_encode …/…/data/Picture/nvidia-logo.yuv 1920 1080 test.jpg --perf

Cut out the trace file for analysis:

tail -n 10000 trace_info.txt

jpeg_write_raw_data() always calls mmap() and never calls munmap

write(1, “start jpeg_write_raw_data\n”, 26) = 26
ioctl(3, _IOC(_IOC_READ|_IOC_WRITE, 0x4e, 0xf, 0x8), 0xfffff36feac0) = 0
mmap(NULL, 3538944, PROT_READ|PROT_WRITE, MAP_SHARED, 88, 0) = 0xffffc997820000

after a few cycles, the program tried mmap again, but it caught an error

mmap(NULL, 3538944, PROT_READ|PROT_WRITE, MAP_SHARED, 88, 0) = -1 ENOMEM (Cannot allocate memory)
close(88) = 0
write(2, “PosixMemMap:84 mmap failed : Can”…, 52) = 5

I also try to debug each loop and look at the command:

sudo pmap <pid_process> -X | grep dmabuf

on each cycle, the program create 3456K dmabuf or 3538944 (same number in mmap strace).
Could you explain, please? Is this a bug or do I need to delete some resources from libjpeg/cinfo?