On Tue, Aug 25, 2020 at 5:31 AM Ivan Zanev <ivanzanev...@gmail.com> wrote:
>
> Hello,
>
> I'm trying to learn a bit more about HashTable in PHP internally and how
> memory is allocated when generating arrays with various sizes. I created a
> simple C script that would call
>
> HashTable *ht = zend_new_array(15);
>
> However, when I compile the script with gcc, I get segmentation fault; gdb
> tells that the problem is located within _emalloc_56, specifically:
>
> 2535 if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
>
> That's how I compiled the script:
> gcc -I./Zend -I. -I./TSRM -I./main Zend/*.c TSRM/TSRM.c test.c -ldl -lm -g
>
> For the configuration I used:
> ./configure
>
> Could you please guide me in the right direction? Is there something I
> should do before calling zend_new_array?
>
> Sincerely,
> Ivan

Does `test.c` include a main? If so you probably want to use the embed
SAPI. If not then you probably want to build it as an extension.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to