Click here to Skip to main content
Click here to Skip to main content

Reduce Memory Usage on Application

, 10 Mar 2010
Rate this:
Please Sign up or sign in to vote.
'Created by Bayu Wibisono, West Java, IndonesiaPrivate Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As LongPrivate Declare Function EmptyWorkingSet Lib "psapi" (ByVal hProcess As Long) As LongPrivate...
'Created by Bayu Wibisono, West Java, Indonesia
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As Long
Private Declare Function EmptyWorkingSet Lib "psapi" (ByVal hProcess As Long) As Long
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Sub ReduceMemory()
    Dim nHandle As Long, nReturn As Long, i_PID As Long
    i_PID = GetCurrentProcessId
    nHandle = OpenProcess(&H1F0FFF, 0, i_PID)
    nReturn = EmptyWorkingSet(nHandle)
    CloseHandle nHandle
End Sub

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Bayu_Malmsteen
Instructor / Trainer Mouse Computer
Indonesia Indonesia
No Biography provided

Comments and Discussions

 
Answerexplanation...!!! PinmemberBayu_Malmsteen12-Mar-10 17:48 
GeneralExplanation, please... PinmemberJohnny J.10-Mar-10 21:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 10 Mar 2010
Article Copyright 2010 by Bayu_Malmsteen
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid