Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Patch for curses module

On Sep 13,  9:35pm, Sebastian Gniazdowski wrote:
} Maybe local means that the memory comes from stack, while zalloc()
} works on heap?

No, parameters are always allocated from the global malloc arena, even
if declared local.  Zsh's internal heap (which is itself allocated
from malloc) is is used only when expanding $param expressions.

} I tried with global variables but still no luck though.
} I have printed sizeof of the struct and it's 16, and 32 on 64 bit machine.

Then your best bet is to create a single parameter 32 bytes in size.
But note that an assignment like that is three allocations, a struct
param plus the name and value, so when you get around to allocating
the colorpairnode you're just as likely to get the freed param as the
space used for the value; but scalars have a 0 in the flags (whereas
PM_ARRAY and DISABLED use the same bits) so that may be OK.

Messages sorted by: Reverse Date, Date, Thread, Author