Re: Fwd: zend_std_get_method : Ad dress 0xffffffff is not stack'd, malloc'd o r (recently) free'd

From: Date: Mon, 31 Mar 2014 12:09:51 +0000
Subject: Re: Fwd: zend_std_get_method : Ad dress 0xffffffff is not stack'd, malloc'd o r (recently) free'd
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-73490@lists.php.net to get a copy of this message
Johaness, thank you for your attention ...
The reason most probably lies within my code, but I don't have enough PHP Zend engine hacking experience to get to it by myself - it's my first PHP extension. Much obliged for intuitions from experienced for what could bring about such kind of fault.
Reduce you ode till it works or share more details .. Yes, that may now be the only possible way to procede.
Depends on what you want to use that memory for and what you optimize for. i.e. if you want to stick data in PHP data structures it should be emalloc'd with one block per item so PHP an free it.
I would like to see from the address value itself whether that address was produced by e{m|re}alloc() so that I have to efree() it, or by pe{m|re}alloc() that I have to pefree(), or whether it falls within some other data segment such as static data which I should not free() in any way. For example: struct record {
    int id;
    char * name;
    . . .
}; . . . struct record * a = emalloc(sizeof(struct record)); a->id = 1; a->name = estrdup("name1"); struct record * b = emalloc(sizeof(struct record)); b->id = 2; b->name = "name2"; Clearly, there should be efree(a->name) as well as efree(a). However, in case of b, only efree(b) is appropriate whereas efree(b->name) would produce an error. How can I find out whether an address belongs to efree() or to pefree() or to none of that? Kajetan

« previous php.internals (#73490) next »