[Closed] gc() and sysInfo.MAXPriority in C++
I was doing a search though all the docs about changing sysInfo.MAXPriority is this just a maxscript thing?
Also what is the best memory dump in C++. similar to calling gc() in maxscript?
there is no memory dump in c++
in general terms you allocate with new and release with delete, but thats quite rare these days with the STL. If you use VS “find in files” in the samples folder of the SDK for the string “MAXPriority” you will get your answer.
You two really now your SKD samples!!! Thanks
Value*
getMAXPriority()
{
def_process_priority_types();
int processID = GetCurrentProcessId();
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, processID);
int priority=GetPriorityClass(hProcess);
CloseHandle( hProcess );
return GetName(processPriorityTypes, elements(processPriorityTypes), priority);
}
Value*
setMAXPriority(Value* val)
{
def_process_priority_types();
int type = GetID(processPriorityTypes, elements(processPriorityTypes), val);
int processID = GetCurrentProcessId();
HANDLE hProcess = OpenProcess(PROCESS_SET_INFORMATION, FALSE, processID);
SetPriorityClass(hProcess,type);
CloseHandle( hProcess );
return val;
}
studying max sdk samples and playing with them is the only way to learn max sdk using. (IMHO)
so, fun if you strip all the extra you don’t need and you just pass it and int of 64,32,128 to change it works fine. I have checked the task manager and it works. But 32 for normal?
“Changed 3dsmax Priority to Low”
MAXPriority: 64
“Changed 3dsmax Priority to Normal”
MAXPriority: 32
“Changed 3dsmax Priority to High”
MAXPriority: 128
int BasicTools::getMAXPriority(){
int processID = GetCurrentProcessId();
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, processID);
int priority = GetPriorityClass(hProcess);
CloseHandle( hProcess );
return priority;
}
void BasicTools::setMAXPriority(int type){
int processID = GetCurrentProcessId();
HANDLE hProcess = OpenProcess(PROCESS_SET_INFORMATION, FALSE, processID);
SetPriorityClass(hProcess, type);
CloseHandle( hProcess );
}
And yes when I have free time on the tube, I just read though the docs.
These are the values you should be passing:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686219(v=vs.85).aspx