[Nasal] copying string data?
Jonatan Liljedahl
lijon at kymatica.com
Tue Nov 27 13:49:38 PST 2007
Andy Ross wrote:
> Jonatan Liljedahl wrote:
>> Ok, so all vectors and hashes (and strings?) I create in a C
>> function will be temp-saved until bytecode is run? But in the
>> example above, x is not in the vector v when naNewVector() is
>> called, doesn't that mean that x could be garbage collected (if it's
>> something other than a object from a naNew*() function)? But perhaps
>> that's only numbers and they're not garbage collectable?
>
> Yes, but x is returned from "create_something...". I was assuming
> that somewhere down in that code the object is being returned from an
> naNew*() call, otherwise it isn't being created. :)
>
> The only time you need to worry about naTempSave() is if you are
> *deleting* an existing reference to an object that you don't want
> collected.
...
> And yes: number in Nasal are always passed by value, and never subject
> to garbage collection. You can't have a reference to a number, it's
> stored *inside* the naRef structure.
Ok, thanks for the clarification!
Perhaps you should put this in nasal.h above naTempSave() in case other
slow-thinkers like me comes along... :)
--
/Jonatan [ http://kymatica.com ]
More information about the Nasal
mailing list