Memory leak in jpeg compression. Bug or my mistake?
问题 I wrote an npm module for capturing webcam input on linux. The captured frame in yuyv format is converted to rgb24 and after compressed to a jpeg image. In the jpeg compression there appears to be a memory leak. So the usage of memory increases continuously. Image* rgb24_to_jpeg(Image *img, Image *jpeg) { // img = RGB24 jpeg_compress_struct cinfo; jpeg_error_mgr jerr; cinfo.err = jpeg_std_error(&jerr); jerr.trace_level = 10; jpeg_create_compress(&cinfo); unsigned char *imgd = new unsigned