Miguel,
Please try this reduced sample:
//----------------------------------------------------------------------
-------------------------//
#include "hbmemory.ch"
PROCEDURE Main()
LOCAL n
REQUEST HB_GT_WIN
DBCREATE( 'TEST', {{'TEST','C',1,0}} )
? 'Used blocks 1 -> ' + AllTrim( Str( Memory( HB_MEM_BLOCKS ) ) )
FOR N := 1 TO 100
USE TEST NEW
NEXT
DbCloseAll()
HB_GCALL(.T.)
? 'Used blocks 2 -> ' + AllTrim( Str( Memory( HB_MEM_BLOCKS ) ) )
RETURN
//----------------------------------------------------------------------
-------------------------//
Ron
On Jun 17, 2008, at 9:06 AM, Ron Pinkas wrote:
> Miguel,
>
> Another proof - just ADD dbCloseArea() inside your Main loop.
>
> Ron
>
> On Jun 17, 2008, at 9:03 AM, Ron Pinkas wrote:
>
>> Miguel,
>>
>> And additional information you should consider is that STRING items
>> are NOT managed by GC at all.
>>
>> Ron
>>
>> On Jun 17, 2008, at 8:45 AM, Ron Pinkas wrote:
>>
>>> Miguel,
>>>
>>> What do you mean by "But in some cases"?
>>>
>>> I don't get any memory leak in your example.
>>>
>>> Ron
>>>
>>> On Jun 17, 2008, at 4:56 AM, Miguel Angel Marchuet wrote:
>>>
>>>> With this example hou can see how we lost 2 blocks for each new
>>>> alias
>>>> and at the end of aplication vm_quit shows memory leaks.
>>>>
>>>> It's normal. But at wm_quit not always free this blocks.
>>>>
>>>> When I execute this example shows loosted blocks, that are released
>>>> normally at wm_Quit. But in some cases :
>>>>
>>>> Total 2242174 allocations (36126 reallocation), of which 2241906
>>>> freed.
>>>> Highest total allocated 9951471 bytes in 93311 blocks.
>>>> WARNING! Memory allocated but not released: 1943 bytes (268 blocks)
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 1 0240FDFC (size 10)
>>>> CNUEVOALIAS(855), "RMCLCA001."
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 2 023430D4 (size 4)
>>>> CNUEVOALIAS(855), "01000000"
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 3 021D46A4 (size 10)
>>>> CNUEVOALIAS(855), "RMCLDE001."
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 4 023A9A5C (size 4)
>>>> CNUEVOALIAS(855), "01000000"
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 5 019A155C (size 10)
>>>> CNUEVOALIAS(855), "RMCLEX001."
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 6 023A93A4 (size 4)
>>>> CNUEVOALIAS(855), "01000000"
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 7 019A09B4 (size 10)
>>>> CNUEVOALIAS(855), "RMPRCA001."
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 8 02343684 (size 4)
>>>> CNUEVOALIAS(855), "01000000"
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 9 0199C95C (size 10)
>>>> CNUEVOALIAS(855), "RMPRDE001."
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 10 024037FC (size 4)
>>>> CNUEVOALIAS(855), "01000000"
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 11 0210397C (size 10)
>>>> CNUEVOALIAS(855), "RMPREX001."
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 12 023768AC (size 4)
>>>> CNUEVOALIAS(855), "01000000"
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 13 02162904 (size 10)
>>>> CNUEVOALIAS(855), "CLIENT001."
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 14 0237619C (size 4)
>>>> CNUEVOALIAS(855), "01000000"
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 15 0232AFEC (size 10)
>>>> CNUEVOALIAS(855), "PROVEE001."
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 16 019B3B0C (size 4)
>>>> CNUEVOALIAS(855), "01000000"
>>>> source\vm\fm.c:971: HB_TR_ERROR Block 17 01997074 (size 10)
>>>> CNUEVOALIAS(855), "ARTICU001."
>>>>
>>>>
>>>> //-----------------------------------------------------------------
>>>> -
>>>> --
>>>> ---//
>>>> // Sample
>>>> //-----------------------------------------------------------------
>>>> -
>>>> --
>>>> ---//
>>>>
>>>> #include "hbmemory.ch"
>>>> PROCEDURE Main()
>>>> LOCAL n
>>>>
>>>> REQUEST HB_GT_WIN
>>>>
>>>> DBCREATE( 'TEST', {{'TEST','C',1,0}} )
>>>>
>>>> ? 'Used blocks 1 -> ' + AllTrim( Str( Memory
>>>> ( HB_MEM_BLOCKS ) ) )
>>>> FOR N := 1 TO 100
>>>> DbUseArea( .T.,, 'TEST', cNuevoAlias( 'ACOUNT' ), .T., .T. )
>>>> NEXT
>>>> DbCloseAll()
>>>> HB_GCALL()
>>>> ? 'Used blocks 2 -> ' + AllTrim( Str( Memory
>>>> ( HB_MEM_BLOCKS ) ) )
>>>>
>>>> RETURN
>>>>
>>>>
>>>> #define WIDTH_SUFIX_ALIAS 3
>>>>
>>>> // Alias dinamico unico basado en el nombre del DBF
>>>> FUNCTION cNuevoAlias( cNomDbf )
>>>>
>>>> LOCAL cAlias
>>>> LOCAL cPref := Left( cFileNoExt( cNomDbf ), 8 )
>>>> LOCAL nArea := 0
>>>>
>>>> WHILE .T.
>>>> cAlias := cPref + StrZero( ++nArea, WIDTH_SUFIX_ALIAS )
>>>> IF Select( cAlias ) == 0
>>>> EXIT
>>>> ENDIF
>>>> ENDDO
>>>>
>>>> RETURN cAlias
>>>>
>>>> function cFileNoExt( cPathMask ) // returns the filename without
>>>> ext
>>>>
>>>> local cName := AllTrim( cFileNoPath( cPathMask ) )
>>>> local n := At( ".", cName )
>>>>
>>>> return AllTrim( If( n > 0, Left( cName, n - 1 ), cName ) )
>>>>
>>>> function cFileNoPath( cPathMask ) // returns just the filename no
>>>> path
>>>>
>>>> local n := RAt( "\", cPathMask )
>>>>
>>>> return Upper( If( n > 0 .and. n < Len( cPathMask ),;
>>>> Right( cPathMask, Len( cPathMask ) - n ),;
>>>> If( ( n := At( ":", cPathMask ) ) > 0,;
>>>> Right( cPathMask, Len( cPathMask ) - n ),;
>>>> cPathMask ) ) )
>>>>
>>>> -------------------------------------------------------------------
>>>> -
>>>> --
>>>> ---
>>>> Check out the new SourceForge.net Marketplace.
>>>> It's the best place to buy or sell services for
>>>> just about anything Open Source.
>>>> http://sourceforge.net/services/buy/index.php
>>>> _______________________________________________
>>>> xHarbour-developers mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
>>>>
>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> ----
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://sourceforge.net/services/buy/index.php
>>> _______________________________________________
>>> xHarbour-developers mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
>>>
>>
>>
>
>
>
> ----------------------------------------------------------------------
> ---
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> xHarbour-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers