we should lose 24 bytes in each turn of the loop
it must release at the end. But it is not so


#include "hbmemory.ch"
#include "hbclass.ch"

#define MAXTEST 10

PROCEDURE MAIN()
    LOCAL n, ao, nMem, nTime

    REQUEST HB_GT_WIN

    nTime := Seconds()
    nMem := Memory( HB_MEM_USED )
    ao := {}

    FOR n := 1 TO MAXTEST

       // Here we lost memory
       aAdd( ao, GetNew( 20, 20 ) )
       // Why xHarbour don't loose 24 bytes

       // Here harbour have a loose of performance. ????
       ao[n] := Nil

       hb_gcAll( .T. )
       ? 'Mem used <- ' + AllTrim( Str( Memory( HB_MEM_USED ) ) )

    NEXT

    ao := nil
    hb_gcAll( .T. )

    ? "We lost " + AllTrim( Str( Memory( HB_MEM_USED ) - nMem ) ) + " Bytes"
    ? "Elapsed time " + AllTrim( Str( Seconds() - nTime ) )

RETURN

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to