![]() ![]() HRet = SetProcessAffinityMask(GetCurrentProcess(), MaxAffinityMask) ' Set affinity to the required number of processors. HRet = GetProcessAffinityMask(GetCurrentProcess(), dwProcMask, dwSysMask) If GetNumProcessors > TriggerNumProcessors Then ' Only change affinity if computer has more than 4 cores. MaxAffinityMask = (2 ^ TriggerNumProcessors) - 1 ' Code adapted from post by Dennis Wi in reply to "Access 2010 Compact & Repair drops indexes" postĭim TriggerNumProcessors As Integer, MaxAffinityMask As Integer ' to avoid "System resource exceeded" errors. ![]() ' Useful for limiting Access to 4 CPUs on multicore Windows 7 computers ' Set processor affinity for this instance of MSACCESS.EXE. ' on Microsoft Office for Developers forums > Access for Developers forumĭeclare Function GetProcessAffinityMask Lib "kernel32.dll" (ByVal hProcess As Long, ByRef dwProcessAffinityMask As Long, ByRef dwSystemAffinityMask As Long) As Booleanĭeclare Function SetProcessAffinityMask Lib "kernel32.dll" (ByVal hProcess As Long, ByVal dwProcessAffinityMask As Long) As Booleanĭeclare Function GetCurrentProcess Lib "kernel32.dll" () As Longĭeclare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO) ' That code was adapted from post by Dennis Wi in reply to "Access 2010 Compact & Repair drops indexes" post ' Windows 10 with more cores seems to confuse Access ![]() ' Access only uses one processor, was able to handle up to four with previous versions of windows ' Attempts to avoid error "System Resource Exceeded" If you find it makes any (or no) difference, please let me know. I have added this to an application that occasionally shows resource exceeded, but it's not clear if it helps or not. The function SetAffinity needs to be called from the AutoExec macro This can be set with Task Manager while Access is running, but the setting is lost when Access closes. ![]() Code below sets core ("affinity") for Access to the first four cores. Perhaps when Windows launches Access, there is some resource difference that depends on which core is assigned to Access. Very hypothetical, but as best as I can find, Access only uses one processor core. See the comment (mid page) about Access and processor core "affinity": ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |