| 닷넷 환경에서는 메모리가 회수되지 않는 경우가 흔한다. 다음은 닷넷에서 win32를 이용한 메모리 강제 회수 방법이다.
using System.Runtime.InteropServices;
#region 강제 메모리 회수
[DllImportAttribute("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int SetProcessWorkingSetSize(IntPtr process, int minimumWorkingSetSize, int maximumWorkingSetSize);
public static void FlushMemory() {
GC.Collect();
GC.WaitForPendingFinalizers();
if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
}
}
#endregion
관련 아티클 : http://www.gosu.net/GosuWeb/ArticleMSView.aspx?ArticleCode=342 |
'Development/C# Application'에 해당되는 글 7건
- 2007/01/30 닷넷 메모리 강제 회수
- 2006/10/30 Mysql Connector 5.0.1 .net 을 이용한 데이터 베이스 연결
- 2006/10/30 Mysql Connector 5.0.1 .net Dll (한글가능)
- 2006/05/18 바탕화면에 윈도우 출력하기
- 2006/03/29 화면 캡쳐하기(JPEG 포멧 100%)
- 2006/03/07 Flash 8 Control 을 닷넷 2005에서 사용할수 없는경우
- 2006/02/27 Visual .net C# 과 Flash 연동 (2)
Posted on 2007/01/30 16:25
Filed Under Development/C# Application
Posted on 2006/10/30 18:39
Filed Under Development/C# Application
string query = "SELECT * FROM member WHERE mem_id = 'TakeOne'"; MySqlCommand command = new MySqlCommand(query, connect); //결과값이 없는 쿼리를 날릴때 //command.ExecuteNonQuery(); //결과값이 있을때 MySqlDataReader reader = command.ExecuteReader(); reader.Read(); MessageBox.Show(reader["mname"].ToString()); command.Connection.Close(); |
Posted on 2006/10/30 18:21
Filed Under Development/C# Application
Dll 파일 MySqlClient\CharSetMap.cs 101번째 줄 수정해서 Dll 새로 생성 mapping.Add("euckr", 949); 닷넷에서는 이 파일을 참조추가 한후 사용하면 된다. |
Posted on 2006/05/18 14:52
Filed Under Development/C# Application
그전에는 그렇게 방법을 모르겠더니... 이번에 하니까 의외로 쉽게 찾았다. IntPtr wndHdle = IntPtr.Zero; wndHdle = FindWindow("Progman", "Program Manager"); IntPtr wndDC = GetWindowDC(wndHdle); IntPtr child = ChildWindowFromPoint(wndHdle, 0, 0); IntPtr child2 = ChildWindowFromPoint(child, 0, 0); DesktopWindow d = new DesktopWindow(); |
Posted on 2006/03/29 10:37
Filed Under Development/C# Application
/// <summary> IntPtr bitmaps = NativeCalls.GetCurrentObject(dc, 7); Image image = Image.FromHbitmap(bitmaps);
ImageCodecInfo ici = GetEncoderInfo("image/jpeg"); } private static ImageCodecInfo GetEncoderInfo(String mimeType) int j; ImageCodecInfo[] encoders; encoders = ImageCodecInfo.GetImageEncoders(); for (j = 0; j < encoders.Length; ++j) if (encoders[j].MimeType == mimeType) return encoders[j]; } return null; } |
Posted on 2006/03/07 14:56
Filed Under Development/C# Application
닷넷 2003에서 테스트할경우 전혀~ 문제가 없던 놈이 my project\obj\Debug 요 위치에 다음 파일을 살짝 끼워줘야 제대로 동작한다. |
Posted on 2006/02/27 17:24
Filed Under Development/C# Application
1. 먼저 '도구 상자'에서 우클릭 -> '항목 추가/제거' 메뉴에서 다음과 같이 Shockwave Flash Object를 추가 ![]() ![]() 2. Shockwave Flash Object 컨트롤을 생성 ![]() 3. 생성된 Shockwave Flash Object에 플래시를 로드한다. private void Form1_Load(object sender, System.EventArgs e)
{
axShockwaveFlash1.Movie = System.IO.Directory.GetCurrentDirectory() + "\\test.swf";
}
4. 플래시에 값 보내기 -씨샵 코드- axShockwaveFlash1.SetVariable("CVals", "씨샵에서 ...");-플래시 코드-
function hello(prop, oldVal, newVal, speedLimit) {
test_txt.text = "안녕 " + newVal;
}
watch("CVals", hello);
5. 플래시에서 씨샵으로 값 보내기 -씨샵 코드 private void axShockwaveFlash1_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)
{
if(e.command=="test")
{
System.Windows.Forms.MessageBox.Show(e.args);
Application.Exit();
}
}-플래시 코드-
image.onRelease = function() {
fscommand("test", "안녕하세요");
};
|
DBConnect.zip
MySql.Data.dll

