Memory Leak in Windows Embedded Compact 2013 (OS or drivers)

      Memory Leak in Windows Embedded Compact 2013 (OS or drivers)

      Hello,

      I am investigating a decrease of the "Available Physical Memory" returned by GlobalMemoryStatus() of about 200 KB/day in Windows Embedded Compact 2013 (efusA9 V1.60 - Firmware, Build: Oct 16 2015/20:01:55, EFUSA9 V3 Solo; LVDS attached Display)

      Although 200 KB/day sound not that much it is too much for a system that has to be available 24/7.

      I have hunt down the problem to an Operating System Issue: When I open Control Panel/System/Memory and observe the "Program Memory in Use" for several hours, it shows the same leak rate of about 200 KB/day (12 KB in 90 minutes). This test is done without our custom application running, with no network connection and no USB devices.

      I therefore suspect something in the OS or one of the drivers.

      Is there any chance to find out the leakee?
      Hello,

      thanks for your Information.
      Think we have a good chance to find or workaroud the issue if there is any. I don't think so.

      Note, Windows CE allocates memory in blocks, is any application requests some blocks and release them later you want see this in the "memory in use". Only if you close the application or memory is in sufficent the (system calls HeapCompact), then you will see "memory in use" decreases.

      Test: Run an application with serveral sub windows-> open an additonal windows "memory in use" increase -> close the dialog "memory in use" does not decrease! Open another window -> ... .

      I will do some test and keep you informed.
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      Hello,

      I think there is an issue because the decrease in available physical memory can be observed with no application running, with no user interaction and no network cable connected.

      Just boot up the board, open the Memory tab in the Control Panel/System and wait. The number of Program Memory in Use will increase by about 12 kB per hour.
      Hello,
      I think there is an issue because the decrease in available physical memory can be observed with no application running, with no user interaction and no network cable connected.
      There are always some services running - but you are right after some hours i did not expect any increase.

      I run a ASA9 over night (19h) with kernel V1.60 and detect no incrasing memory. This morning i got EFUSA9 solo and repeat a more detailed test (runtime < 2h). Think tommorw we have a result and can check what to do. Details (versions/code) see below.

      Microsoft Windows CE Bootloader Common Library Version 1.2 Built Oct 9 2015 17:44:45
      Microsoft Windows CE Bootloader for efusA9 Built Oct 9 2015
      Portions copyright (c) 2012 F&S Elektronik Systeme GmbH
      Boot Loader, Version 1.20
      NBoot, Version VN25
      HW rev. 1.20

      HW-Watchdog: ON
      System ready!
      Preparing for download...
      Press >S< to step into monitor...
      AUTO BOOT enabled
      +ReadKernelRegionFromNandFlash
      Image Signature in Flash Memory found (dwSig=0x43454345)
      TOC pointer=0x80491A48

      ROMHDR (cTOC = 0x00271a48) ---------------------
      DLL First : 0x4001efd7
      DLL Last : 0x4013f000
      Physical First : 0x80220000
      Physical Last : 0x804fa518
      Num Modules : 32
      RAM Start : 0x80620000
      RAM Free : 0x8066b000
      RAM End : 0x90620000
      Num Copy Entries : 2
      Copy Entries Offset : 0x802bdfe0
      Prof Symbol Length : 0x00000000
      Prof Symbol Offset : 0x00000000
      Num Files : 8
      Kernel Flags : 0x00000001
      FileSys RAM Percent : 0x20202020
      Driver Glob Start : 0x00000000
      Driver Glob Length : 0x00000000
      CPU : 0x01c4
      MiscFlags : 0x0002
      Extensions : 0x80221f00
      Tracking Mem Start : 0x00000000
      Tracking Mem Length : 0x00000000
      Kernel (2921kB) read from flash disk started finished in 1000 milliseconds
      Kernel read from NAND
      INFO: OEMLaunch: Jumping to Physical Address 0x10220000h (Virtual Address 0x10220000h)...

      Jumping to Kernel @ 0x10220000
      INFO:OALLogSetZones: dpCurSettings.ulZoneMask: 0xb
      Windows CE Kernel for ARM (Thumb Enabled)
      Enabling L2 cache
      OEMInit: silicon rev = 0x12
      SMP support disabled

      efusA9 V1.60 - Firmware Init
      Copyright (c) 2013 F&S Elektronik Systeme GmbH
      Build: Oct 16 2015/20:01:55
      [OAL] MACB: Disabled
      [OAL] RestartReason: IPP
      FSPART: FS partition driver loaded
      BINFS: RegisterVolume - Mounted volume '\BINFS'
      PM-NETDCU: STARTED
      BE2: Version 1.4, ActiveKey = Drivers\Active\01
      BE2: Version 1.4, ActiveKey = Drivers\Active\04
      IPU: Version 1.3, ActiveKey = Drivers\Active\10
      HCD: Version 1.1, ActiveKey = Drivers\Active\17
      PP: Version 1.1, ActiveKey = Drivers\Active\19
      VDI: Version 1.1, ActiveKey = Drivers\Active\20
      ENET: Version 1.3, ActiveKey = Comm\ETHNETA
      BE2: Version 1.4, ActiveKey = Drivers\Active\35
      NI2C: Version 0.1, ActiveKey = Drivers\Active\36
      NI2C: Version 0.1, ActiveKey = Drivers\Active\37
      NI2C: Version 0.1, ActiveKey = Drivers\Active\38
      Serial: Version 1.4, ActiveKey =
      Serial: Version 1.4, ActiveKey =
      Serial: Port disabled. Serial debug is on !
      Serial: Version 1.4, ActiveKey =
      TCH: Version 1.1, ActiveKey = Drivers\Active\43
      SHC: Version 1.2, ActiveKey = Drivers\Active\44
      SHC: Version 1.2, ActiveKey = Drivers\Active\45
      SHC: Version 1.2, ActiveKey = Drivers\Active\46
      CID: Version 2.5, ActiveKey = Drivers\Active\47
      CID: Version 2.5, ActiveKey = Drivers\Active\48
      NSPI: Version 3.7, ActiveKey = Drivers\Active\49
      NSPI: Version 3.7, ActiveKey = Drivers\Active\50
      PWM: Version 1.3, ActiveKey = Drivers\Active\51
      EXTRTC: Version 1.2, ActiveKey = Drivers\Active\52
      SHC: [USDHC3] SD card inserted
      PPU: Version 1.1, ActiveKey = Drivers\Active\54
      BCS: Version 1.4, ActiveKey = Drivers\Active\55
      DIO: Version 1.4, ActiveKey = Drivers\Active\56
      FRW: Version 1.3, ActiveKey = Drivers\Active\59
      GALCORE 4.6.9(9754) (Aug 13 2014 10:51:18)
      Major GPU: SysIntr=34 MemBases=0x130000 MMU Version=0
      2D GPU: SysIntr=35 MemBases=0x134000 MMU Version=0
      Video memory: BaseAddress=0x0 PhysBase=0x106cc000 size=0x7000000 physSize=0x0
      LCD: Version 1.0, ActiveKey = Drivers\Display\LCD
      LCD: Read registry settings from Drivers\Display\LCD
      LCD: Read registry settings from Drivers\Display\LCD
      LCD: ASTADPEDT1.dll - Init failed
      LCD: Display-Mode 19, Name ET070080
      TchProxy: touch driver cann't be loaded. Check touch driver registry settings.
      NDCUCFG V 61 started. Platform: efusA9
      NDCUCFG Open COM1: at 115200 Baud
      CreateFile() failed -> ERROR COM1:
      CheckAutoStart: Version 1.7, LaunchNum = 100
      SoftRTC disabled
      ENET: LinkState: FULL-DUP, 100Mbps
      TCH: Could not enable touch panel
      USBHost : Hub [address(1) / layer(0)] SUSPEND OK
      UFN: Version 1.1, ActiveKey = Drivers\Active\76
      Periodic check of memory load
      Runtime 000h 00min: memory load 46 percent(154202112 bytes)
      Runtime 000h 01min: memory load 46 percent(154206208 bytes)
      ENET: LinkState: DISCONNECTED
      Runtime 000h 02min: memory load 46 percent(154198016 bytes)
      Runtime 000h 02min: memory load 46 percent(154165248 bytes)
      Runtime 000h 02min: memory load 46 percent(154157056 bytes)
      Runtime 000h 28min: memory load 46 percent(154161152 bytes)
      Runtime 000h 30min: memory load 46 percent(154161152 bytes)
      Runtime 001h 00min: memory load 46 percent(154161152 bytes)
      Runtime 001h 16min: memory load 46 percent(154165248 bytes)
      Runtime 001h 22min: memory load 46 percent(154169344 bytes)
      Runtime 001h 30min: memory load 46 percent(154169344 bytes)
      Runtime 001h 32min: memory load 46 percent(154173440 bytes)

      #include <winbase.h>
      int wmain(int argc, wchar_t *argv[])
      {
      DWORD counter=0;
      DWORD l=0;
      MEMORYSTATUS m;

      RETAILMSG(1,(L"Periodic check of memory load\r\n"));
      while(true)
      {
      GlobalMemoryStatus(&m);
      if(counter%1000 == 0||(l != m.dwAvailPhys))
      {
      DWORD t=GetTickCount();
      DWORD h=t/3600000;
      DWORD mn=(t/60000)%60;
      DWORD mm = m.dwTotalPhys-m.dwAvailPhys;
      RETAILMSG(1,(L"Runtime %03dh %02dmin: memory load %d percent(%d bytes)\r\n", h, mn, m.dwMemoryLoad, mm));
      }
      l = m.dwAvailPhys;
      counter++;
      Sleep(1800);
      }
      return 0;
      }

      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

      Post was edited 3 times, last by “fs-support_ZU” ().

      Hello,

      i think i cannot confirm a memory leak. You are right there are an inrcrease over 12kB/h. But sometimes there is also a release over several kB. Measured over 48h i saw no alarming increase.

      Over the weekend i will run a final test. I also record the fluctuation and extremum.

      PS. ok i rewatch my logs, i am not sure. Think on many we know it.
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

      Post was edited 1 time, last by “fs-support_ZU” ().

      Hello,

      ok i can confirm the leak. I test 68h under WEC2013/V1.60. The trend is clear now.
      Will will resolve it aps.
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

      Post was edited 1 time, last by “fs-support_ZU” ().

      Hello,

      I tested WEC2013 1.50 by just watching the System Properties / Memory Tab and also notice the approx. 12KB/h increase of Program Memory in use:

      Time
      Program Memory In Use
      11:35
      158624 KB
      11:55
      158632 KB
      12:45
      158636 KB
      13:10
      158640 KB
      14:25
      158652 KB
      15:00
      158656 KB

      I will keep the system running without any external interaction and report my observations.

      Post was edited 1 time, last by “martinmoe” ().

      Hello,

      this issue is resolved with Windows Embedded Compact 2013 updates up to 2016M10 (Kernel Version V2.20, refer changelog).
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.