He observado que cuando pinto un bitmap (se observa mejor en los bitmaps grandes) con oPrinter:SayBitMap() de la clase TPrinter se me produce una fuga de memoria. Lo observo con un una utilidad de sistema que me va diciendo la memoria usada en %. Cuando el .bmp es pequeño, al ser un % pequeño no se observa, pero cuando se hace la operacion varias veces o el bitmap es grande entonces se ve que la memoria no es released hasta que se sale del programa.
Entiendo que este no debe ser el comportamiento de GlobalAlloc()/ GlobalFree()
La verdad es que me corre prisa solucionarlo. Agradecido de antemano siquiera por alguna pista.
Anexo metodo (original) TPrinter():SayBitMap (Fwh 7.12/ xHarbour 1.0).
- Code: Select all Expand view
//----------------------------------------------------------------------------//
METHOD SayBitmap( nRow, nCol, xBitmap, nWidth, nHeight, nRaster ) CLASS TPrinter
local hDib, aBmpPal, hBitmap, hPalette
if ::hDC = 0
return nil
endif
if ( ValType( xBitmap ) == "N" ) .or. ! File( xBitmap )
aBmpPal = PalBmpLoad( xBitmap )
hBitmap = aBmpPal[ 1 ]
hPalette = aBmpPal[ 2 ]
hDib = DibFromBitmap( hBitmap, hPalette )
PalBmpFree( hBitmap, hPalette )
else
hDib = DibRead( xBitmap )
endif
if hDib == 0
return nil
endif
if ! ::lMeta
hPalette = DibPalette( hDib )
endif
DibDraw( ::hDCOut, hDib, hPalette, nRow, nCol,;
nWidth, nHeight, nRaster )
GlobalFree( hDib )
if ! ::lMeta
DeleteObject( hPalette )
endif
return nil
Saludos