Modify

Opened 16 years ago

Closed 16 years ago

Last modified 14 years ago

#1196 closed Bug (Fixed)

_GDIPlus_BitmapUnlockBits - Memory is not released

Reported by: eukalyptus Owned by:
Milestone: 3.3.1.0 Component: AutoIt
Version: 3.3.0.0 Severity: None
Keywords: _GDIPlus_BitmapUnlockBits UnlockBits Memory GdiPlus GDI+ Cc:

Description

_GDIPlus_BitmapUnlockBits dose not release the allocated memory.
If you change the DllCall-type "int*" to "ptr" it works fine - see example:

#include <ScreenCapture.au3>

Global $hScreen, $hBitmap, $aMem, $tData

_GDIPlus_Startup()
$hScreen=_ScreenCapture_Capture("", 0, 0, -1, -1, False)
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hScreen)

For $i=1 To 50
    $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, _GDIPlus_ImageGetWidth($hBitmap), _GDIPlus_ImageGetHeight($hBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB)
    _GDIPlus_BitmapUnlockBits($hBitmap, $tData)
    Sleep(50)
    $aMem = MemGetStats()
    ConsoleWrite("original function; step " & $i & "; mem usage: " & $aMem[0] & @LF)
Next

ConsoleWrite(@LF)

For $i=1 To 50
    $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, _GDIPlus_ImageGetWidth($hBitmap), _GDIPlus_ImageGetHeight($hBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB)
    _GDIPlus_BitmapUnlockBits_($hBitmap, $tData)
    Sleep(50)
    $aMem = MemGetStats()
    ConsoleWrite("test function; step " & $i & "; mem usage: " & $aMem[0] & @LF)
Next

Func _GDIPlus_BitmapUnlockBits_($hBitmap, $tBitmapData)
    Local $aResult

    $aResult = DllCall($ghGDIPDll, "int", "GdipBitmapUnlockBits", "hwnd", $hBitmap, "ptr", DllStructGetPtr($tBitmapData)) ;Type ptr instead of int*
    If @error Then Return SetError(@error, @extended, False)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc   ;==>_GDIPlus_BitmapUnlockBits

Attachments (1)

_GDIPlus_BitmapUnlockBits.au3 (1.3 KB ) - added by eukalyptus 16 years ago.

Download all attachments as: .zip

Change History (4)

by eukalyptus, 16 years ago

comment:1 by J-Paul Mesnage, 16 years ago

Resolution: Fixed
Status: newclosed

As been fixed with the global verification of MSDN matching type for all Include files

comment:2 by TicketCleanup, 16 years ago

Milestone: Future Release

Automatic ticket cleanup.

comment:3 by J-Paul Mesnage, 14 years ago

Milestone: Future Release3.3.1.0

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.