zbatev

Accumulating Memory Usage

23 posts in this topic

#1 ·  Posted (edited)

Hi All,

I've got an application that starts 8,000K memory usage according to the Task Manager but as time goes by it grows higher and higher.

The structure is like this(this is not the actual code):

I was monitoring the memory usage at random times and its like this:

9,856 K

10,220 K

11,216 K

11,220 K

12,156 K

12,984 K

12,988 K

13,860 K

...and this will continue to accumulate in time

While 1 ;this is because this application run 24 hours
 $valueA = False
  While $valueA = False
   for $x = 1 to 10
     if $monitorThis = $requiredValue then ;this portion will monitor the time 
       $valueA = True
       exitloop
     endif
   next
  Wend

  if $valueA = true then
    ;do some stuff
    sleep(840000) ;14 minutes
  endif
Wend
Edited by zbatev

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Search for WinAPIEx.au3 by Yashied and the Function _WinAPI_EmptyWorkingSet() which "Removes as many pages as possible from the working set of the specified process."

OR

Call this Function in you .au3 to reduce the memory of the current process.

Func _ReduceMemory()
    Local $aReturn = DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
    If @error = 1 Then
        Return SetError(1, 0, 0)
    EndIf
    Return $aReturn[0]
EndFunc   ;==>_ReduceMemory
Edited by guinness
1 person likes this

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Wow, thanks a lot... Let me try that and I'll get back to you as soon as I'm done monitoring for improvements

Share this post


Link to post
Share on other sites

Is it a program you've designed or another process e.g. Opera.exe?


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Is it a program you've designed or another process e.g. Opera.exe?

Actually it is an automatic screen capture program that I made. We dont want to buy commercial version and the free version does not meet the requirements.

My boss wants to get screen shots at these times in (mm:ss):

59:55, 00:00, 00:05

14:55, 15:00, 15:05

29:55, 30:00, 30:05

44:55, 45:00, 45:05

I'm done with that but the problem is as I've mentioned the memory size accumulating over time.

I'm currently testing your suggestions and see which one will work...

Edited by zbatev

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hi All,

I've got an application that starts 8,000K memory usage according to the Task Manager but as time goes by it grows higher and higher.

The structure is like this(this is not the actual code):

I was monitoring the memory usage at random times and its like this:

9,856 K

10,220 K

11,216 K

11,220 K

12,156 K

12,984 K

12,988 K

13,860 K

...and this will continue to accumulate in time

While 1 ;this is because this application run 24 hours
 $valueA = False
  While $valueA = False
   for $x = 1 to 10
     if $monitorThis = $requiredValue then ;this portion will monitor the time 
       $valueA = True
       exitloop
     endif
   next
  Wend

  if $valueA = true then
    ;do some stuff
    sleep(840000) ;14 minutes
  endif
Wend

For me, one problem is the bad design of the loop, maybe it stucks in the "While $valueA = False" loop that have no sleep() this affect the CPU usage, i never run a script for so long time as a entire day, but you can try another method of scripting because there is something, maybe in the rest of the script that is not properly managed.

My boss wants to get a screen shots at these times(in mm:ss):

59:55, 00:00, 00:05

14:55, 15:00, 15:05

29:55, 30:00, 30:05

44:55, 45:00, 45:05

Are these times taken for the real clock time or times from the script start to run? Edited by monoscout999

Share this post


Link to post
Share on other sites

Another tip to add what monoscout999 said is look at AdlibRegister() if you want to call a Function every 14 minutes instead of Sleeping.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Hi guinness,

I think it's working the memory usage has dramatically lowered to 800K.

I also noticed one thing, each time I show GUISetState(@SW_SHOW) a hidden form GUISetState(@SW_HIDE), the memory usage accumulates.

What i did now is applied the same concept as you suggested like:

GUISetState(@SW_HIDE)
_ReduceMemory()

But I'm guessing I'm using the wrong flags @SW_SHOW and @SW_HIDE? Because I was thinking more like the visual basic Load 'Form' Unload 'Form'.

Share this post


Link to post
Share on other sites

Another tip to add what monoscout999 said is look at AdlibRegister() if you want to call a Function every 14 minutes instead of Sleeping.

'AdlibRegister()' --- I'm looking into this right now.

Share this post


Link to post
Share on other sites

A quick Example so you get an idea >>

Global $iCount = 0

AdlibRegister("_Function", 3000)
While 1
    Sleep(100)
    If $iCount = 5 Then ; Just for testing purposes, this will Exit after 5 MsgBox()'s have been displayed.
        AdlibUnRegister("_Function")
        Exit
    EndIf
WEnd

Func _Function()
    MsgBox(64, "MsgBox() - " & $iCount + 1, "This is showing because the Function is called every 3 seconds.")
    $iCount += 1
EndFunc   ;==>_Function

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Hi monoscout999,

Thank you for the criticism I appreciate it.

For me, one problem is the bad design of the loop, maybe it stucks in the "While $valueA = False" loop that have no sleep() this affect the CPU usage, i never run a script for so long time as a entire day, but you can try another method of scripting because there is something, maybe in the rest of the script that is not properly managed.

Are these times taken for the real clock time or times from the script start to run?

Yes I was hesitant to put Sleep() function since I might miss the time requirement, which is to the second:

59:55, 00:00, 00:05

14:55, 15:00, 15:05

29:55, 30:00, 30:05

44:55, 45:00, 45:05

And yes this are real clock time NOT from when the script start to run.

Do you have any other suggestion where I can hit those specified time without missing one? The only solution I could think of is not pushing a Sleep function even for a fraction of the time, and it is actually working(sacrificing PC workload I think).

Edited by zbatev

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Hi guinness & monoscout999,

I think I've manage to eliminate the weakness of my design by using the _ReduceMemory() and AdlibRegister(), I've reconstructed my design into this form:

CaptureScreen()

Func CaptureScreen()
While 1
 $valueA = False
  While $valueA = False
   for $x = 1 to 10
     if $monitorThis = $requiredValue then ;this portion will monitor the time 
       $valueA = True
       exitloop
     endif
   next
  Wend

  if $valueA = true then
    ;do some stuff
    _ReduceMemory()
    AdlibRegister("CaptureScreen",840000) ;calls itself after 14 minutes
  endif
Wend
EndFunc

I still have an infinite loop without a Sleep() or similar function BUT that infinite loop will only run for a maximum of 1 minute every 15th minute, the _ReduceMemory() will eliminate unecessary/unused resources and AdlibRegister tooks care of the PC workload.

Thank you very much for scouting problems like this and sharing your genius!

Edited by zbatev

Share this post


Link to post
Share on other sites

i think the weaknes is still there but if it work well, then it is ok

Share this post


Link to post
Share on other sites

Those loops do look a little excessive.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I agree with JohnOne I keep imagining some bitmap and graphics objects left undestroyed, I think the puppet is still under the table. Maybe you want to show us the puppet :) the rest of your code ie. ?

Share this post


Link to post
Share on other sites

I agree with JohnOne I keep imagining some bitmap and graphics objects left undestroyed, I think the puppet is still under the table. Maybe you want to show us the puppet :) the rest of your code ie. ?

I bet for this.. the Bitmap object created by the screenshot is not being deleted.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Thanks guys actually everything is working fine right now but I will still do some more math so I will eliminate 1 or 2 loops... I'll keep this thread updated when I've got something new....

And yes I still think the puppet is still under the table but for now they have to settle with it while I'm working on improving the application.

There are some things that need to be fix like the AdlibRegister is inside a loop, I think I have to let it out. From the looks of it, its really messy I've got some cleaning to do.

Edited by zbatev

Share this post


Link to post
Share on other sites

Actually it is an automatic screen capture program that I made. We dont want to buy commercial version and the free version does not meet the requirements.

My boss wants to get screen shots at these times in (mm:ss):

59:55, 00:00, 00:05

14:55, 15:00, 15:05

29:55, 30:00, 30:05

44:55, 45:00, 45:05

I'm done with that but the problem is as I've mentioned the memory size accumulating over time.

I'm currently testing your suggestions and see which one will work...

Empty working set pushes the memory on to the pagefile, if you select show pagefile in task manager you'll probably notice this getting bigger rather than the physical memory, any memory items required then have to be pulled back out from the pagefile when needed, seeing as you say its a screen grabber then there will be a GDI or GDI+ object that your not disposing of which is taking up the memory, I have some GDI+ scripts that create hundreds of objects and destroy them over a period of time and the memory is totally stable if you dispose of everything propperly

Share this post


Link to post
Share on other sites

The _WinAPI_EmptyWorkingSet() method works good here. Is there a similar way to empty/reduce the virtual memory size as well?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now