Memory Leak - Richedit

User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Memory Leak - Richedit

Post by nageswaragunupudi »

We fixed ximage.prg and included it in FWH2102.

Now ximage:Save( .t., cFile, ... ) properly saves the image as viewed including the freehand drawings.
We sent the revised ximage.prg to you by email.
Please confirm.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Memory Leak - Richedit

Post by nageswaragunupudi »

The main issue raised in the topic is "Resource Leakage."

The method oImage:CopyToClipboard() has apparent resource leakage because TClipBoard():SetBitmap( ohBmp ) has the leakage again because the C level function "SetClipboardData( CF_BITMAP, hBitmap ) )" has this "apparent" leakage.
In fact, there is no real leakage but CheckRes() reports it as leakage due to the way FWH internal functions mark a resource as created and released.

Fixed now, in FWH version 2102.
Regards

G. N. Rao.
Hyderabad, India
csincuir
Posts: 419
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Memory Leak - Richedit

Post by csincuir »

Hola Rao,
Confirmo de recibido el archivo, pero, al momento de enlazarlo con mi aplicación me hace falta esta función: FW_DrawShadow(), por lo que no pude comprobar si el problema de pérdida de memoria esta solucionado.
La versión de FWH que estoy utilizando es la de September 2019

Gracias por el apoyo para solucionar este problema de perdida de memoria.

Saludos cordiales.

Carlos
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Memory Leak - Richedit

Post by nageswaragunupudi »

Please add a dummy function

Code: Select all | Expand

function FW_DrawShadow();return nil 

to the ximage.prg and build your application.
Regards

G. N. Rao.
Hyderabad, India
csincuir
Posts: 419
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Memory Leak - Richedit

Post by csincuir »

Hola Rao,
Listo, agregué la funcion como me indicaba y ya pude enlazar el nuevo ximage.prg a mi aplicación.

Hice la prueba de guardar los cambios de la imagen con oImage:Save( .t., cImage ) y funciono muy bien, ahora si guarda los cambios la clace xImage

El problema es que, aún persiste la perdida de memoria.

Aca envío el resultado que presenta SetResDebug:

Code: Select all | Expand

08-03-2021 10:28:42: C:\appsis\dev\sisgen.exe -- BMP,-855306115,TBITMAP:LOADIMAGE(826)->TBITMAP:DEFINE(282)->FICHACLINICA(8630)->(b)CLIE01(981)->TBTNBMP:CLICK(704)->TBTNBMP:LBUTTONUP(990)->TCONTROL:HANDLEEVENT(1791)->TBTNBMP:HANDLEEVENT(2030)->_FWH(3559)->DIALOGBOX(0)->TDIALOG:ACTIVATE(304)->CLIE01(1339)->(b)CLIECONS(4624)->TWINDOW:LDBLCLICK(2092)->TCONTROL:LDBLCLICK(1814)->TWBROWSE:LDBLCLICK(1229)->TWINDOW:HANDLEEVENT(0)->TWBROWSE:HANDLEEVENT(1801)->_FWH(3559)->WINRUN(0)->TMDIFRAME:ACTIVATE(1097)->TSSisMain:ACTIVAR(1472)->MAIN(102)    08-03-2021 10:28:42: C:\appsis\dev\sisgen.exe -- BMP,553980671,TBITMAP:LOADIMAGE(826)->TBITMAP:DEFINE(282)->FICHACLINICA(8631)->(b)CLIE01(981)->TBTNBMP:CLICK(704)->TBTNBMP:LBUTTONUP(990)->TCONTROL:HANDLEEVENT(1791)->TBTNBMP:HANDLEEVENT(2030)->_FWH(3559)->DIALOGBOX(0)->TDIALOG:ACTIVATE(304)->CLIE01(1339)->(b)CLIECONS(4624)->TWINDOW:LDBLCLICK(2092)->TCONTROL:LDBLCLICK(1814)->TWBROWSE:LDBLCLICK(1229)->TWINDOW:HANDLEEVENT(0)->TWBROWSE:HANDLEEVENT(1801)->_FWH(3559)->WINRUN(0)->TMDIFRAME:ACTIVATE(1097)->TSSisMain:ACTIVAR(1472)->MAIN(102)    08-03-2021 10:28:42: C:\appsis\dev\sisgen.exe -- CUR,65567,XBROWSENEW(16307)->HOJAGRAFICA(9437)->(b)BITACORAMEDICA(9020)->TBUTTON:CLICK(179)->TBUTTON:HANDLEEVENT(1755)->_FWH(3559)->SENDMESSAGE(0)->TDIALOG:COMMAND(433)->TWINDOW:HANDLEEVENT(0)->TDIALOG:HANDLEEVENT(1136)->DIALOGBOX(0)->TDIALOG:ACTIVATE(304)->BITACORAMEDICA(9023)->(b)FICHACLINICA(8809)->TBUTTON:CLICK(179)->TBUTTON:HANDLEEVENT(1755)->_FWH(3559)->SENDMESSAGE(0)->TDIALOG:COMMAND(433)->TWINDOW:HANDLEEVENT(0)->TDIALOG:HANDLEEVENT(1136)->_FWH(3559)->DIALOGBOX(0)->TDIALOG:ACTIVATE(304)->FICHACLINICA(8817)->(b)CLIE01(981)->TBTNBMP:CLICK(704)->TBTNBMP:LBUTTONUP(990)->TCONTROL:HANDLEEVENT(1791)->TBTNBMP:HANDLEEVENT(2030)->_FWH(3559)->DIALOGBOX(0)->TDIALOG:ACTIVATE(304)->CLIE01(1339)->(b)CLIECONS(4624)->TWINDOW:LDBLCLICK(2092)->TCONTROL:LDBLCLICK(1814)->TWBROWSE:LDBLCLICK(1229)->TWINDOW:HANDLEEVENT(0)->TWBROWSE:HANDLEEVENT(1801)->_FWH(3559)->WINRUN(0)->TMDIFRAME:ACTIVATE(1097)->TSSisMain:ACTIVAR(1472)->MAIN(102)    08-03-2021 10:28:42: C:\appsis\dev\sisgen.exe -- ====================================================================================================    


Saludos cordiales

Carlos
User avatar
karinha
Posts: 7993
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 6 times
Contact:

Re: Memory Leak - Richedit

Post by karinha »

Holá, crea una cuenta en:

https://mega.nz/

Y un .RAR, ponga en el Mega Upload, e muestre el link de descarga aqui para testes.

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Memory Leak - Richedit

Post by nageswaragunupudi »

Because oImage:Save( .t., ... ) is working, you do not need to copy and paste to TBitmap/TImage object. We also advised not to do it.

In other words, you totally remove "oImage:CopyToClipBoard( .T. ), GuardarGraficaClinica( oImage, aImages )" and instead use oImage:Save()

As we also explained above, copying bitmap to clipboard is resulting in an apparent resource leakage but there is no real leakage. The bug is only in maintaining the internal count of resources by FWH. This is fixed in 2102.

Anyway, I shall be glad if you let me see your latest program (by email).
Regards

G. N. Rao.
Hyderabad, India
csincuir
Posts: 419
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Memory Leak - Richedit

Post by csincuir »

nageswaragunupudi wrote:Because oImage:Save( .t., ... ) is working, you do not need to copy and paste to TBitmap/TImage object. We also advised not to do it.

In other words, you totally remove "oImage:CopyToClipBoard( .T. ), GuardarGraficaClinica( oImage, aImages )" and instead use oImage:Save()

As we also explained above, copying bitmap to clipboard is resulting in an apparent resource leakage but there is no real leakage. The bug is only in maintaining the internal count of resources by FWH. This is fixed in 2102.

Anyway, I shall be glad if you let me see your latest program (by email).


Hola Rao,
Gracias de nuevo por tu respuesta.
Si, en mi aplicación ya no utilizo la opción "Copy and Paste" ahora guardo directamente la imagen con el método :Save de la xImage que me enviaras.
Te envíe por correo los ultimos cambios del programa para que lo puedas ver.

Ahora veré la posibilidad de actualizar de mi versión de FWH, ya que me quedé atrasado ya más de un año.

Saludos cordiales.

Carlos
csincuir
Posts: 419
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Memory Leak - Richedit

Post by csincuir »

karinha wrote:Holá, crea una cuenta en:

https://mega.nz/

Y un .RAR, ponga en el Mega Upload, e muestre el link de descarga aqui para testes.

Saludos.


Hola Karinha.
Este es el link de mega para descargues la aplicación y hagas tus pruebas. (estoy trabajando con FWH 19.09)
https://mega.nz/file/qh42kSaB#XaVkWb8ELyJKBiSRthUwLC_e8qUKfdBrSKRCYR-PlqI

Saludos

Carlos
User avatar
karinha
Posts: 7993
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 6 times
Contact:

Re: Memory Leak - Richedit

Post by karinha »

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
xmanuel
Posts: 773
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Been thanked: 5 times
Contact:

Re: Memory Leak - Richedit

Post by xmanuel »

Pregunta:
SetResDebug devuelve la fuga de memoria o de recursos?

Lo digo porque una fuga de memoria es cuando hacemos un hb_xgrab o un hb_itemNew y no se libera.
Para esto último Harbour está preparado solo hay que crear las librerías de Harbour con estadísticas, realmente solo afecta a hbvm.lib y a hbvmmt.lib.
Cuando quiero saber si hay fugas de memoria enlazo un de esas dos y al finalizar la ejecución del programa este genera un LOG con las perdidas.

Lo uso para la construcción de mis LIBs y asegurarme que no hay memory Leak.
Va de escándalo!!!!
______________________________________________________________________________
Sevilla - Andalucía
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Memory Leak - Richedit

Post by nageswaragunupudi »

Thanks for the information.

Here, the discussion is not at all about harbour memory leaks, but about the Windows resource leaks.
SetResDebug reports resource leaks.
Regards

G. N. Rao.
Hyderabad, India
User avatar
karinha
Posts: 7993
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 6 times
Contact:

Re: Memory Leak - Richedit

Post by karinha »

xmanuel wrote:Pregunta:
SetResDebug devuelve la fuga de memoria o de recursos?

Lo digo porque una fuga de memoria es cuando hacemos un hb_xgrab o un hb_itemNew y no se libera.
Para esto último Harbour está preparado solo hay que crear las librerías de Harbour con estadísticas, realmente solo afecta a hbvm.lib y a hbvmmt.lib.
Cuando quiero saber si hay fugas de memoria enlazo un de esas dos y al finalizar la ejecución del programa este genera un LOG con las perdidas.

Lo uso para la construcción de mis LIBs y asegurarme que no hay memory Leak.
Va de escándalo!!!!


Master, hay algun problema en usar las dos hbvm.lib y a hbvmmt.lib? Que hace hbvmmt.lib ó vmmmt.lib?

Gracias,

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
xmanuel
Posts: 773
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Been thanked: 5 times
Contact:

Re: Memory Leak - Richedit

Post by xmanuel »

hbvm.lib y hbvmmt.lib realmente son la misma.
La primera es para programación estándar y la segunda para usar multi hilos.
Las dos contienen las mismas funciones de VM -> Virtual Memory.
O lo que es lo mismo la gestión de memoria de Harbour.
Eso implica que solo se debería usar una a la vez ya que la que se ponga en segundo lugar no la considera.

Si las queréis yo las tengo construidas para todos los compiladores de 32 y 64. (Salvo bcc64)

Cuando hay perdida de memoria Harbour crea automaticamente un archivo llamado hb_out.log con un contenido parecido a este:

Code: Select all | Expand

Total memory allocated: 107997 bytes (1109 block(s))Warning, memory allocated but not released: 533 bytes (8 block(s))fm.c:1242: HB_TR_ERROR Block 1 (size 52) NEW(0), "402CA500A02F9C0020319C00102F9C0000000000302C9C0000000000000000000000000000000000000000000000000000000000"fm.c:1242: HB_TR_ERROR Block 2 (size 40) NEW(0), "10319C0010319C00B08C600001000100008000000400EEFFA02E9C00000000000000000000000000"fm.c:1242: HB_TR_ERROR Block 3 (size 288) NEW(0), "0000000000000000508A9900000000000000000001000100000000000100F1FF30BB980000000000C88A9900000000000000000001000100000000000100F0FFC82B98000000000000000000000000000000000001000100000000000100EFFF0000000000000000B88B9900000000000000000001000100000000000100EEFF7830980000000000308C9900000000000000000001000100000000000100EDFFA8B598000000000000000000000000000000000001000100000000000100ECFF000000000000000070879900000000000000000001000100000000000100EBFFD0C198000000000038859900000000000000000001000100000000000100EAFF"fm.c:1242: HB_TR_ERROR Block 4 (size 32) NEW(0), "902E9C00902E9C00E078600000000000102D9C000C0000000C00000001000000"fm.c:1242: HB_TR_ERROR Block 5 (size 44) NEW(0), "0000000000000000000000000100000001000000000000000000000001000000010000000000000028309C00"fm.c:1242: HB_TR_ERROR Block 6 (size 10) NEW(0), "RDLSQLITE."fm.c:1242: HB_TR_ERROR Block 7 (size 24) NEW(0), "00146000C014600060C8650040106000E0106000E0116000"fm.c:1242: HB_TR_ERROR Block 8 (size 11) CONNECT(0), "hdodemo.db." 
______________________________________________________________________________
Sevilla - Andalucía
csincuir
Posts: 419
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: Memory Leak - Richedit

Post by csincuir »

karinha wrote:Carlos, teste ahora:

https://mega.nz/file/FM0AmApQ#jJ90yf7JJkrs7ktZn_EPaI3-VLWbpm2KIKhY63tLO4o

Regards, saludos.


Gracias Karinha
Hice la prueba, pero siempre tengo el registro de perdida de memoria.
Por el momento voy a utilizar la modificación de xImage que me enviara Rao, en lo que logro actualizar mi FWH

Gracias a todos por su ayuda,

Saludos cordiales

Carlos.
Post Reply