User`s manual
10 - 10 10 - 10
MELSEC
10 ERROR CODE
(c) Sample program: When setting by VC
(Example of min. working set size 1MB and max. working set size 3MB)
#define ERROR -1
short ChangeWorkingSetSize()
{
DWORD dwProcessId; /*Application program ID variable*/
HANDLE hProcess; /*Application program handle variable*/
DWORD dwMinimumWorkingSetSize; /*Minimum working set variable*/
DWORD dwMaximumWorkingSetSize; /*Maximum working set variable*/
/*Obtain the application program ID*/
dwProcessId = GetCurrentProcessId();
/*Open the application program handle*/
hProcess =
OpenProcess(PROCESS_SET_QUOTA+PROCESS_QUERY_INFORMATION,FALSE,dwProcessId);
if(hProcess == NULL){
/*Error end*/
return(ERROR);
}
/*Obtain the maximum working set size and minimum working set size of the application program */
if(GetProcessWorkingSetSize(hProcess,&dwMinimumWorkingSetSize,&dwMaximumWorkingSetSize)==0){
/*Error end*/
CloseHandle(hProcess);
return(ERROR);
}
/*Set the minimum working set size to 1MB*/
dwMinimumWorkingSetSize = 1 * 1024 * 1024;
/*Set the maximum working set size to 3MB*/
dwMaximumWorkingSetSize = 3 * 1024 * 1024;
/*Change the maximum working set size and minimum working set size of the application program */
if(SetProcessWorkingSetSize(hProcess,dwMinimumWorkingSetSize,dwMaximumWorkingSetSize)==0){
/*Error end*/
CloseHandle(hProcess);
return(ERROR);
}
/*Close the application program handle*/
CloseHandle(hProcess);
/*Normal return*/
return(0);
The set sizes shown here are reference sizes. Adjust the sizes according to your system.