惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - 千年寒冰

C# 操作Excel大全 Window7+vs2008+QT环境搭建 基于三汇语音卡的呼叫中心开发--(一) 解决NTLDR is missing,系统无法启动的方法 mssql charindex 美化表单 屏幕取字原理 jsp web项目开发详述 jsp request 对象详解 博文阅读密码验证 - 博客园 WML教程9:Select List 控件 jsp的session介绍 (转) 想一想 javabean :类与函数调用(数据库访问类) JSP中的pageEncoding和contentType属性(转) javabean在jsp中的调用(原创) 远程连接SQL Server (转) 三天学好ADO(转) jsp调用javabean实例
Wince 或Windows平台 C#调用Bitmap对象后资源应该如何释放
千年寒冰 · 2013-04-08 · via 博客园 - 千年寒冰

做Wince项目时遇到的问题,

 将相机拍摄的图像从SD卡读入BitMap,然后在克隆给PictureBox;即:Bitmap bmp=new Bitmap(FilePath); Picture.Image=(Image)bmp.Clone();bmp.Dispose();查看前2张图片没有问题,第3张图片时就报内存溢出了.

尝试了多种释放资源的方式,包括GC强制回收都没有效果,后来看到别人C++代码里面对BitMap位图操作时,采用DeleteObject进行释放的。我也在C#里进行了尝试,还真释放干净了;记录这里备忘;

    [DllImport("coredll.dll")]

    [return: MarshalAs(UnmanagedType.Bool)]

    public static extern bool DeleteObject(IntPtr hgdiobj);