GPU内存资源没有释放
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 23.8k
- Forks
- 4.5k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 37
Description
error log | 日志或报错信息 | ログ
context | 编译/运行环境 | バックグラウンド
版本:ncnn-20220721-android-vulkan
运行环境:Android 10,MTK
how to reproduce | 复现步骤 | 再現方法
1.加载网络,模型
ncnn::Option opt;
opt.lightmode = true;
opt.num_threads = 4;
opt.blob_allocator = &g_blob_pool_allocator;
opt.workspace_allocator = &g_workspace_pool_allocator;
// use vulkan compute
int gpu_count = ncnn::get_gpu_count();
if (gpu_count != 0)
opt.use_vulkan_compute = true;
if(squeezenet==nullptr){
squeezenet = new ncnn::Net();
}
squeezenet->opt = opt;
2.卸载网络,模型
g_blob_pool_allocator.clear();
g_workspace_pool_allocator.clear();
squeezenet_words.clear();
if(squeezenet!=nullptr){
squeezenet->clear();
delete squeezenet;
squeezenet = nullptr;
}
ncnn::destroy_gpu_instance();
3.期望:
如果只是用CPU:
opt.use_vulkan_compute = false;
资源卸载没有问题;
但是如果使用了GPU:
opt.use_vulkan_compute = true;
内存会有2m没有释放。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Android 10 MTK case using the shown ncnn::Option settings, comparing CPU mode with Vulkan compute enabled. Trace g_blob_pool_allocator.clear(), g_workspace_pool_allocator.clear(), squeezenet->clear(), deletion, and ncnn::destroy_gpu_instance(); done means the reported 2 MB is released after unloading the model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, cpp
- Domain
- machine-learning, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100