Results 1 to 1 of 1
  1. #1
    T0ybanead00
    T0ybanead00 is offline
    Guest
    Join Date
    2013 Dec
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Thumbs up Liberar Recursos (Consumo Memoria de una aplicación)

    En muchos casos nuestro SO se encuentra muy saturado y cuando deseamos jugar un juego que consume mucho
    recurso de memoria nuestro SO se cuelga o tarda mucho en responder. Para este caso publico un Source donde libera
    la memoria del juego o aplicación con alto consumo.

    Code:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, tlhelp32, StdCtrls;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    function GetProcessId(FileName: String): DWORD;
    var
       proc: TProcessEntry32;
       hSysSnapshot: THandle;
    begin
       proc.dwSize := SizeOf(TProcessEntry32);
       hSysSnapshot:= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
       if (hSysSnapshot <> INVALID_HANDLE_VALUE) and Process32First(hSysSnapshot, proc) then
       begin
         repeat
           if String(proc.szExeFile) = FileName then
           begin
             Result:= proc.th32ProcessID;
             break;
           end;
         until not (Process32Next(hSysSnapshot, proc));
       end;
       CloseHandle(hSysSnapshot);
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      hProcess: THandle;
    begin
      hProcess:= OpenProcess(PROCESS_ALL_ACCESS, false, GetProcessId('game.exe'));
      if Win32Platform = VER_PLATFORM_WIN32_NT then
        SetProcessWorkingSetSize(hProcess, $FFFFFFFF, $FFFFFFFF);
      CloseHandle(hProcess);
    
    end;
    
    end.
    Solo indica el nombre del proceso a liberar la memoria y listo

    Credito Source: Desconocido

Similar Threads

  1. Tutorial Retirando ERRO.Memoria
    By soberba2014 in forum Point Blank
    Replies: 0
    Last Post: 2013-07-31, 01:06 PM
Visitors found this page by searching for:
Nobody landed on this page from a search engine, yet!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •