View Single Post
  #1 (permalink)  
Old 02-03-2010, 12:36 AM
Byak@'s Avatar
Byak@ Byak@ is offline
Basic4ppc Veteran
 
Join Date: Jul 2008
Posts: 416
Send a message via ICQ to Byak@
Awards Showcase
Beta Tester 
Total Awards: 1
Default minimize usage memory of program

i'm read about .Net and memory and find interesting code
Code:
Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        AddHandler Application.Idle, AddressOf FlushMemory
    
End Sub

    Private 
Sub FlushMemory()
        
If System.Environment.OSVersion.Platform = PlatformID.Win32NT Then
            SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -
1, -1)
        
End If
    
End Sub
    
    <DllImport(
"kernel32.dll")> _
    Public Shared Function SetProcessWorkingSetSize(ByVal handle 
As IntPtr, ByVal minimumWorkingSetSize As Integer, ByVal maximumWorkingSetSize As Integer) As Boolean
    
End Function
this work on Desctop only and set a working set of program to min

how use it on b4ppc?
__________________
I'll Kill you, I'll Crash you, I'll never be yours!
--------------------------------------------------
Qtek s110; o2 XDA Flame; Nokia E63 red;
ASUS Eee PC 901 (Windows XP sp3) + TouchScreen;
Reply With Quote