Segmentation Fault when trying to call zend_new_array.
| From: | Ivan Zanev | Date: | Tue, 25 Aug 2020 11:31:04 +0000 |
| Subject: | Segmentation Fault when trying to call zend_new_array. | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-111682@lists.php.net to get a copy of this message | ||
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