mirror of
https://github.com/halaxa/json-machine.git
synced 2025-01-17 13:08:16 +01:00
Fixed memory leaks
This commit is contained in:
parent
da3f0f0b0c
commit
f3bc5ecb10
2
Makefile
2
Makefile
@ -113,7 +113,7 @@ ext-build: ## Build JSON Machine's PHP extension
|
||||
docker build --tag json-machine-ext ext/build
|
||||
docker rm json-machine-ext || true
|
||||
docker run --volume "$$PWD:/json-machine" -it json-machine-ext /bin/bash -c \
|
||||
"cd /json-machine/ext/jsonmachine; phpize && ./configure && make && make install && cd /json-machine && vendor/bin/phpunit --filter TokensTest"
|
||||
"cd /json-machine/ext/jsonmachine; phpize && ./configure && make clean && make && make install && cd /json-machine && php -d xdebug.mode=off -d opcache.enable_cli=1 -d opcache.jit_buffer_size=100M test/performance/testPerformance.php"
|
||||
|
||||
zephir: ## Build JSON Machine's PHP extension
|
||||
docker build --tag json-machine-zephir ext/jsonmachine
|
||||
|
@ -37,13 +37,13 @@ RUN git clone https://github.com/php/php-src.git
|
||||
RUN cd php-src \
|
||||
&& git checkout php-8.0.9 \
|
||||
&& ./buildconf --force \
|
||||
&& ./configure --enable-debug --enable-mbstring --disable-mbregex \
|
||||
--prefix=$HOME/php-bin/DEBUG \
|
||||
--with-config-file-path=$HOME/php-bin/DEBUG/etc \
|
||||
&& ./configure --enable-mbstring --disable-mbregex \
|
||||
--prefix=$HOME/php-bin \
|
||||
--with-config-file-path=$HOME/php-bin/etc \
|
||||
&& make -j`nproc` \
|
||||
&& make install
|
||||
|
||||
ENV PATH="/home/user/php-bin/DEBUG/bin:${PATH}"
|
||||
ENV PATH="/home/user/php-bin/bin:${PATH}"
|
||||
|
||||
RUN mkdir php-bin/DEBUG/etc
|
||||
COPY php.ini php-bin/DEBUG/etc/php.ini
|
||||
RUN mkdir php-bin/etc
|
||||
COPY php.ini php-bin/etc/php.ini
|
||||
|
@ -19,7 +19,7 @@
|
||||
ZEND_PARSE_PARAMETERS_END()
|
||||
#endif
|
||||
|
||||
void append_char_to_zval_string(zval *str, char c)
|
||||
static zend_always_inline void append_char_to_zval_string(zval *str, char c)
|
||||
{
|
||||
size_t len = Z_STRLEN_P(str);
|
||||
zend_string *new_str = zend_string_realloc(Z_STR_P(str), len + 1, 0);
|
||||
@ -93,18 +93,16 @@ PHP_FUNCTION(jsonmachine_next_token)
|
||||
|
||||
if (tokenBoundaries[byte]) {
|
||||
if (Z_STRLEN_P(zTokenBuffer)) {
|
||||
zval zReturnStr;
|
||||
ZVAL_BOOL(zEscaping, false);
|
||||
ZVAL_BOOL(zInString, false);
|
||||
ZVAL_LONG(zLastIndex, i);
|
||||
ZVAL_NEW_STR(&zReturnStr, Z_STR_P(zTokenBuffer));
|
||||
ZVAL_STRING(zTokenBuffer, "");
|
||||
RETURN_STR(Z_STR(zReturnStr));
|
||||
ZVAL_COPY_VALUE(return_value, zTokenBuffer);
|
||||
ZVAL_EMPTY_STRING(zTokenBuffer);
|
||||
return;
|
||||
}
|
||||
if (colonCommaBracket[byte]) {
|
||||
ZVAL_BOOL(zEscaping, false);
|
||||
ZVAL_BOOL(zInString, false);
|
||||
ZVAL_STRING(zTokenBuffer, "");
|
||||
ZVAL_LONG(zLastIndex, i+1);
|
||||
RETURN_STR(zend_string_init((char *)&byte, 1, 0));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user