On Mon, 28 Apr 2008, Miguel Angel Marchuet wrote: > Sorry with this, I recover more than I spend. > What is the error ?
This test reports: druzus:/tmp/4# hbmk -n -w t2.prg -fmstat && ./t2 Harbour devel build 1.1-1 Intl. (Rev. 8378) Copyright (c) 1999-2008, http://www.harbour-project.org/ Compiling 't2.prg'... t2.prg(65) Warning W0001 Ambiguous reference: 'SELF' t2.prg(65) Warning W0001 Ambiguous reference: 'NVAL' t2.prg(65) Warning W0001 Ambiguous reference: 'SELF' t2.prg(65) Warning W0001 Ambiguous reference: 'NVAL' Lines 888, Functions/Procedures 7 Generating C source output to 't2.c'... Done. Mem used <- 186487 Mem used <- 186503 Mem used <- 186519 Mem used <- 186535 Mem used <- 186551 Mem used <- 186567 Mem used <- 186583 Mem used <- 186599 Mem used <- 186615 Mem used <- 186631 We lost -1233 Bytes Elapsed time 0.00 druzus:/tmp/4# The result -1233 is caused by the fact that after: // To load the class Problem() You have value in return stack item which can be deallocated only by GC because it has cross references and you do not call hb_gcAll(.t.) before: nMem := Memory( HB_MEM_USED ) So this time you haven't freed all memory before getting the initial amount of allocated memory and finally you have negative results. Just add: hb_gcAll(.t.) before: nMem := Memory( HB_MEM_USED ) and you will have: We lost 0 Bytes No memory leak and no any other problems in this test except the wrong line: METHOD uValue( nVal ) BLOCK {|u| If( PCount() > 1, ::uVar[nVal] := u, ::uVar[nVal] ) } which is the source of compile time warnings about and will cause RT error if you will want to call ctl:uValue method. But it's programmer problem in this code only. best regards, Przemek _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour