Modify

Opened 15 years ago

Closed 15 years ago

Last modified 13 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 15 years ago.

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by eukalyptus

comment:1 Changed 15 years ago by Jpm

  • Resolution set to Fixed
  • Status changed from new to closed

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

comment:2 Changed 15 years ago by TicketCleanup

  • Milestone set to Future Release

Automatic ticket cleanup.

comment:3 Changed 13 years ago by Jpm

  • Milestone changed from Future Release to 3.3.1.0

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.