- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When i use the code below, i found that, the memory used by my application will increse 200KBytes ~ 800KBytes after every call .
How can i fix it ?
//VPP
_mfx_surf_in_vpp.Data.U = _mfx_surf_in_vpp.Data.V = _mfx_surf_in_vpp.Data.Y = data->data;
_mfx_status = ::MFXVideoVPP_RunFrameVPPAsync(_mfx_session, &_mfx_surf_in_vpp, &_mfx_surf_out_vpp, NULL, &_mfx_sync_point_vpp);
if (_mfx_status != MFX_ERR_NONE) {
return -401;
}
do {
_mfx_status = ::MFXVideoCORE_SyncOperation(_mfx_session, _mfx_sync_point_vpp, 1);
if (_mfx_status == MFX_ERR_NONE) {
break;
}
else if (_mfx_status == MFX_WRN_IN_EXECUTION) {
continue;
}
else //if (sts == MFX_ERR_ABORTED)
{
return -206;
}
} while (true);
The init param is this :
memset(&_mfx_init_param, 0, sizeof(_mfx_init_param));
_mfx_init_param.Implementation = 514;// MFX_IMPL_HARDWARE;
_mfx_init_param.Version = { 17, 1 };
_mfx_init_param.ExternalThreads = 0;
_mfx_init_param.NumExtParam = 0;
_mfx_init_param.ExtParam = NULL;
_mfx_init_param.GPUCopy = MFX_GPUCOPY_ON;
memset(&_mfx_video_param_vpp, 0, sizeof(_mfx_video_param_vpp));
_mfx_video_param_vpp.AsyncDepth = 1;
_mfx_video_param_vpp.ExtParam = NULL;
_mfx_video_param_vpp.IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY | MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
_mfx_video_param_vpp.NumExtParam = 0;
_mfx_video_param_vpp.vpp.In.FourCC = MFX_FOURCC_YUY2;
_mfx_video_param_vpp.vpp.In.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
_mfx_video_param_vpp.vpp.In.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
_mfx_video_param_vpp.vpp.In.Width = _mfx_video_param_vpp.vpp.In.CropW = _videoFile->GetVideoWidth();
_mfx_video_param_vpp.vpp.In.Height = _mfx_video_param_vpp.vpp.In.CropH = _videoFile->GetVideoHeight();
_mfx_video_param_vpp.vpp.In.FrameRateExtN = 30;
_mfx_video_param_vpp.vpp.In.FrameRateExtD = 1;
_mfx_video_param_vpp.vpp.Out.FourCC = MFX_FOURCC_NV12;
_mfx_video_param_vpp.vpp.Out.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
_mfx_video_param_vpp.vpp.Out.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
_mfx_video_param_vpp.vpp.Out.Width = _mfx_video_param_vpp.vpp.Out.CropW = _videoFile->GetVideoWidth();
_mfx_video_param_vpp.vpp.Out.Height = _mfx_video_param_vpp.vpp.Out.CropH = _videoFile->GetVideoHeight();
_mfx_video_param_vpp.vpp.Out.FrameRateExtN = 30;
_mfx_video_param_vpp.vpp.Out.FrameRateExtD = 1;
mfxVideoParam tmp_video_param = { 0 };
_mfx_status = ::MFXVideoVPP_Query(_mfx_session, &_mfx_video_param_vpp, &tmp_video_param);
if (_mfx_status != MFX_ERR_NONE) {
return -101;
}
memcpy(&_mfx_video_param_vpp, &tmp_video_param, sizeof(_mfx_video_param_vpp));
memset(&_mfx_serf_req_vpp, 0, sizeof(_mfx_serf_req_vpp));
_mfx_status = ::MFXVideoVPP_QueryIOSurf(_mfx_session, &_mfx_video_param_vpp, _mfx_serf_req_vpp);
if (_mfx_status != MFX_ERR_NONE) {
return -102;
}
_mfx_status = ::MFXVideoVPP_Init(_mfx_session, &_mfx_video_param_vpp);
if (_mfx_status != MFX_ERR_NONE) {
return -103;
}
_mfx_status = ::MFXVideoVPP_GetVideoParam(_mfx_session, &_mfx_video_param_vpp);
if (_mfx_status != MFX_ERR_NONE) {
return -104;
}
memset(&_mfx_vpp_stat, 0, sizeof(_mfx_vpp_stat));
_mfx_status = ::MFXVideoVPP_GetVPPStat(_mfx_session, &_mfx_vpp_stat);
if (_mfx_status != MFX_ERR_NONE) {
return -105;
}
memset(&_mfx_sync_point_vpp, 0, sizeof(_mfx_sync_point_vpp));
memset(&_mfx_surf_in_vpp, 0, sizeof(_mfx_surf_in_vpp));
memset(&_mfx_surf_out_vpp, 0, sizeof(_mfx_surf_out_vpp));
memcpy(&_mfx_surf_in_vpp.Info, &_mfx_video_param_vpp.vpp.In, sizeof(_mfx_surf_in_vpp.Info));
memcpy(&_mfx_surf_out_vpp.Info, &_mfx_video_param_vpp.vpp.Out, sizeof(_mfx_surf_out_vpp.Info));
_mfx_surf_in_vpp.Data.ExtParam = NULL;
_mfx_surf_in_vpp.Data.NumExtParam = 0;
_mfx_surf_in_vpp.Data.MemType = _mfx_serf_req_vpp[0].Type;
_mfx_surf_in_vpp.Data.PitchHigh = 0;
_mfx_surf_in_vpp.Data.PitchLow = _videoFile->GetVideoWidth() * 2;
_mfx_surf_in_vpp.Data.FrameOrder = 0;
_mfx_surf_in_vpp.Data.MemId = 0;
//_mfx_surf_in_vpp.Data.Y = (mfxU8 *)::malloc(_mfx_surf_in_vpp.Data.PitchLow * 720);
//_mfx_surf_in_vpp.Data.U = _mfx_surf_in_vpp.Data.V = _mfx_surf_in_vpp.Data.Y;
_mfx_surf_out_vpp.Data.ExtParam = NULL;
_mfx_surf_out_vpp.Data.NumExtParam = 0;
_mfx_surf_out_vpp.Data.MemType = _mfx_serf_req_vpp[1].Type;
_mfx_surf_out_vpp.Data.PitchHigh = 0;
_mfx_surf_out_vpp.Data.PitchLow = _videoFile->GetVideoWidth();
_mfx_surf_out_vpp.Data.FrameOrder = 0;
_mfx_surf_out_vpp.Data.MemId = 0;
_mfx_surf_out_vpp.Data.Y = (mfxU8 *)::malloc(_mfx_surf_out_vpp.Data.PitchLow * 2 * _videoFile->GetVideoHeight());
_mfx_surf_out_vpp.Data.U = _mfx_surf_out_vpp.Data.V = _mfx_surf_out_vpp.Data.Y + _mfx_surf_out_vpp.Data.PitchLow * _videoFile->GetVideoHeight();
- Tags:
- Development Tools
- Graphics
- Intel® Media SDK
- Intel® Media Server Studio
- Media Processing
- Optimization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can somebody help me to resolve the problem ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If no one helps me solve this problem, I can only abandon the Intell Medial SDK!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
Sorry for late response. Could you clarify what version of Media SDK and what OS do you use ? We'll investigate that problem (currently we have no report about memory leaks). You've provided most of the code , but if you could create and send me reproducer project - it would help me to find the answer faster.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Fedor Z. (Intel)
The SDK version I use is Intel (R) Media SDK 2018 R2, libmfx_vs2015.lib for static library files, and the operating system versions are Windows 7 flagship version SP1 (x64) and Windows 10 enterprise version (x64). I can provide you with reproducer project, you need to provide me with your e-mail address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please send reproducer to Fedor.Zharinov@intel.com , I'll investigate the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yang,
Really apologized for late response, could you give me some updates on the current status?
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mark,
I sent you the example code of VS2015. Your colleague has responded to me and said that he can't reproduce the phenomena on my side.
So I still have memory leaks.
Maybe the term "memory leak" is inaccurate, because after calling the MFXClose function, the increased memory does drop.
However, my problem is that memory keeps increasing without calling the MFXClose function. Because our program runs VPP for a long time, it may run 24 hours before calling the MFXClose function, and only a few hours running, the memory is fully occupied by MediaSDK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
It looks like our focus is on how to reproduce the memory clean up issue.
I sent you my test result on 10/1 and didn't get reply, so looks like it was lost, let me copy it here:
Here is my results:
- An ApolloLake machine with Windows 10/MSDK2019R1/VS2019, can’t reproduce.
- A SkyLake machine with Windows 10/MSDK2018R2/VS2015, can’t reproduce.
- In the screen capture you sent, you seems run it under Admin, I tried this and still can’t observe the leak.
- I found the memory keep increasing when I clicked start then stop buttons repeatedly, this is firmly reproducible in both 1 and 2 configurations.
I don’t see any problem in your code snippet in forum since it was stripped out other code; I check you reproduce code and found _stop() function only did 2 things: stop the thread, free buffer. So for #4, I think _free_buffer() call doesn’t deallocate memory cleanly since each time stop click, I saw the memory size was not back to the previous value before start click.
Could we have a simplified version of the reproducer?
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mark:
I see your email. Thank you for your reply.
Maybe my problem and the code I gave you confused you.
My problem is that memory keeps increasing without calling the MFXClose function.
In the code I gave you, the _stop() function does not call the MFXClose function. But that's not my point. My point is that when the _strat() function is called, memory will always increase. So, you don't need to click the stop button. You just click the start button and watch the memory grow.
The code I give you is the code that I streamlined from our project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yang,
There is no confusion, I just tried to guess what might be the problem.
Your case was covered by #1, #2, #3, so the only thing I didn't check is, the condition that sample runs very long time, I only did 1 hour, how long did you run when you found the memory increasing?
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mark:
I ran the program at "Windows7 Ultimate Edition + SP1" and "Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz 2.60GHz".
I ran the program only for 10 minutes, and the memory increased from 117,780 K to 501,920 K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yang,
Based on our 2019 R1 release notes, we only support Windows 10.
Although 2018 R2 still support Windows 7, I would recommend to focus on Window 10 to reproduce and fix. Does this make sense to you?
I go through the post and you mentioned about Windows 10, did you reproduce the same issue on Windows 10 yet?
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mark :
At your reminder, I retest it. It was found that both 2018 R2 and 2019 R1 had this problem under Windows 7, but neither 2018 R2 nor 2019 R1 had this problem under Windows 10. So I can solve my problem only by using Windows 10 and not Windows 7.
Thank you for your patient help during this period. Have a nice day at work!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Yang,
I believe this is a good choice since we will not support Windows 7 from 2019R1 on.
This will avoid more debugging but if this causes any inconvenience on your product, please let me know and I will send feedback to dev team.
Again, apologized for delayed response to keep your waiting so long.
Mark
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page