Jump to content
Sign in to follow this  

Memory leak

Recommended Posts

What can couse a memory leak in a script ?

i declared all the Var's and all Func vars are local

i even placed Var = Func to make sure the return value (not needed) doesnt leak so what can it be ?

my program keeps getting bigger and bigger in the taskmanager mem usage

maybe if we could see your script or a sample script we could help.

Edit: damn, to slow :)

Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post

Link to post
Share on other sites

Here is what I tried:

#Include <A3LGDIPlus.au3>
#Include "FileListToArrayEX.au3"
#include <Array.au3>

$Folder = IniRead(@ScriptDir & "\Data.ini", "Wallpaper", "folder", "")
$Sleep = Number(IniRead(@ScriptDir & "\Data.ini", "Wallpaper", "time_in_ms", 1000))

$pictureArray = _FileListToArrayEx($Folder, '*.jpg;*.bmp', 1, '', False)

HotKeySet("+!^w", "_ChangeWallpaper")

While 1
    If IniRead(@ScriptDir & "\Data.ini", "Wallpaper", "Slide", "") = "True" Then 

Func _ChangeWallpaper()
    RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
    RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2')
    ;Randomize next wallpaper instead of grabbing next one
    $CurrentFile = $Folder & $pictureArray[Random(1,$pictureArray[0], 1)]
    ;If file is jpg, convert to bmp and store in temp directory
    Switch StringRight($CurrentFile, 3)
        Case "jpg"
            $result = _GDIP_StartUp()
            If NOT $result Then 
                MsgBox(0,"","Error calling _GDIP_StartUp()")
            $hImage = _GDIP_ImageLoadFromFile ($CurrentFile)
            $sCLSID = _GDIP_EncodersGetCLSID ("BMP")
            If $sCLSID Then MsgBox(0,"","Error retrieving clsid")
            _GDIP_ImageSaveToFileEx ($hImage, @TempDir & "\999.bmp", $sCLSID)
            _GDIP_ShutDown ()
            $CurrentFile = @TempDir & "\999.bmp"
        Case "bmp"
            ;Do nothing
    RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $CurrentFile)
    DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $CurrentFile, "int", 0)
    TrayTip ( "Wallpaper", "Changed to " & $CurrentFile, 10)


But there is always an error calling _GDIP_StartUp() despite running a fully updated copy of XP Pro

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
Sign in to follow this  

  • Create New...