mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 14:01:53 +00:00
Use the PHP memory management functions emalloc and efree.
This commit is contained in:
parent
147b743d4c
commit
46e509c0a9
4
v8js.cc
4
v8js.cc
@ -694,7 +694,7 @@ static void php_v8js_timer_push(long time_limit, long memory_limit, php_v8js_ctx
|
||||
V8JSG(timer_mutex).lock();
|
||||
|
||||
// Create context for this timer
|
||||
php_v8js_timer_ctx *timer_ctx = (php_v8js_timer_ctx *)malloc(sizeof(php_v8js_timer_ctx));
|
||||
php_v8js_timer_ctx *timer_ctx = (php_v8js_timer_ctx *)emalloc(sizeof(php_v8js_timer_ctx));
|
||||
|
||||
// Calculate the time point when the time limit is exceeded
|
||||
std::chrono::milliseconds duration(time_limit);
|
||||
@ -717,7 +717,7 @@ static void php_v8js_timer_pop()
|
||||
if (V8JSG(timer_stack).size()) {
|
||||
// Free the timer context memory
|
||||
php_v8js_timer_ctx *timer_ctx = V8JSG(timer_stack).top();
|
||||
free(timer_ctx);
|
||||
efree(timer_ctx);
|
||||
|
||||
// Remove the timer context from the stack
|
||||
V8JSG(timer_stack).pop();
|
||||
|
Loading…
Reference in New Issue
Block a user