[Gambas-devel] Returning a reference to an array ...

Gareth Bult gareth at ...560...
Tue Jan 13 03:36:32 CET 2009


Ok ... sounds reasonable .. but how do I destroy an array ?

----- Original Message -----
From: "Benoit Minisini" <gambas at ...1...>
To: "mailing list for gambas developers" <gambas-devel at lists.sourceforge.net>
Sent: Monday, 12 January, 2009 11:28:16 PM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: [Gambas-devel] Returning a reference to an array ...

On mardi 13 janvier 2009, Gareth Bult wrote:
> Arhrhrhr, sorry, I should've spotted that one.
>
> It's all looking pretty tight now, except for the Signal#11 I'm generating
> on my unref on the second pass through this routine .. I guess I'm
> misunderstanding memory management somewhere. First pass works fine, second
> pass not so good .. anything obvious?
>
> What's confusing me is I'm successfully refing and unrefing "dev", and I'm
> refing THIS->devices, however for some reason it doesn't like the unref.
> Should I not be using ref/unref on the array?
>

You must use GB.Ref() when storing an element into the object array, because 
you are accessing the array memory directly (this is faster).

But you must not use GB.Unref() when you unref the array, because this is done 
automatically when the array is destroyed. You don't know, when unreferencing 
the array, if it will be destroyed immediately or not.

-- 
Benoit Minisini

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gambas-devel mailing list
Gambas-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel

-- 
Managing Director, Encryptec Limited
Tel: 0845 5082719, Mob: 0785 3305393
Email: gareth at ...560... 
Statements made are at all times subject to Encryptec's Terms and Conditions of Business, which are available upon request.




More information about the Devel mailing list