Hello Claudio, On Apr 12, 2010, at 9:03 AM, sr...@adinet.com.uy wrote:
> Hi all, > > I have a doubt with the function hb_arrayNew > When I create an array in C: > > #pragma begindump > #include "hbapi.h" > #include "hbapiitm.h" > > HB_FUNC (MyFunc) > {............ > ............. > > pArray = hb_itemNew (NULL); > hb_arrayNew (pArray, size); > > .............. > ............... > } > > > before the program ends I have necessarily to call: ( i guess that you mean "the function" instead of "the program" ) > > hb_itemRelease (pArray); > > to free the memory allocated? Yes > or HARBOUR releases automatically? No, even MyFunc() needs to return the new array it needs to be released: HB_FUNC( MYFUNC ) { PHB_ITEM pArray = hb_itemNew( NULL ); <your operations with pArray here> hb_itemReturnRelease( pArray ); } Please read the following link, even it's based on Clipper 5.2 it perfectly applies to current Harbour too. Also please note that you need to use uppercase on the function name ( "MyFunc" is wrong ). best regards, Teo
_______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour