How to change the system memory division ?
The default setting for system memory division is 50:50. That means 50% of memory for object store and 50% of memory for programs.
It is possible to change this by using NetDCU tool memcfg.exe or the following code:
Code
- extern "C" BOOL GetSystemMemoryDivision (
- LPDWORD lpdwStorePages,
- LPDWORD lpdwRamPages,
- LPDWORD lpdwPageSize );
- extern "C" DWORD SetSystemMemoryDivision ( DWORD );
- #define ONE_KB 1024
- #define SYSMEM_CHANGED 0
- #define SYSMEM_MUSTREBOOT 1
- #define SYSMEM_REBOOTPENDING 2
- #define SYSMEM_FAILED 3
- DWORD StorePages, RamPages, PageSize, TotPages;
- DWORD dwMemDivision = 50;
- if( !GetSystemMemoryDivision(&StorePages, &RamPages, &PageSize) )
- return FALSE;
- TotPages = StorePages+RamPages;
- StorePages = TotPages * (100 - dwMemDivision) / 100;
- DWORD dwRet = SetSystemMemoryDivision ( StorePages );
- if( SYSMEM_FAILED == dwRet )
- {
- ERRORMSG(1,(_T("Can't enlarge prgram memory (%d)\r\n"), GetLastError()));
- return FALSE;
- }