Author Topic: when does interpret frees object local variable?  (Read 1381 times)

Offline FallenTree

  • BFF
  • ***
  • Posts: 485
    • View Profile
when does interpret frees object local variable?
« on: February 20, 2013, 05:45:33 pm »
assume I have a object something.c

void create() {
mixed* arr = localtime(time());
}

I found current driver doesn't free  arr after create() finished.  is it suppose to? or is all local variable simply freed upon object destruction() ?

Offline wodan

  • BFF
  • ***
  • Posts: 434
  • Drink and code, you know you want to!
    • View Profile
Re: when does interpret frees object local variable?
« Reply #1 on: February 21, 2013, 08:45:15 am »
local variables go on the stack, so unless your stack pointer has gone bad, it was gone at the end of the function.

as for the actual array, that depends on the refcount, but in this case it probably should hit 0 at the end of the function and be freed.