Dmitry Volyntsev
October 04, 2023 04:56PM
details: https://hg.nginx.org/njs/rev/c0aad58cfadb
branches:
changeset: 2215:c0aad58cfadb
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Wed Oct 04 13:35:38 2023 -0700
description:
Improved memory footprint of RegExp.prototype.split().

diffstat:

src/njs_regexp.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)

diffs (44 lines):

diff -r cf85d0f8640a -r c0aad58cfadb src/njs_regexp.c
--- a/src/njs_regexp.c Tue Oct 03 18:09:06 2023 -0700
+++ b/src/njs_regexp.c Wed Oct 04 13:35:38 2023 -0700
@@ -1773,6 +1773,10 @@ njs_regexp_prototype_symbol_split(njs_vm
e = njs_min(e, length);

if (e == p) {
+ if (njs_object_slots(&z)) {
+ njs_regexp_exec_result_free(vm, njs_array(&z));
+ }
+
q = q + 1;
continue;
}
@@ -1794,6 +1798,10 @@ njs_regexp_prototype_symbol_split(njs_vm
}

if (array->length == limit) {
+ if (njs_object_slots(&z)) {
+ njs_regexp_exec_result_free(vm, njs_array(&z));
+ }
+
goto done;
}

@@ -1818,10 +1826,18 @@ njs_regexp_prototype_symbol_split(njs_vm
}

if (array->length == limit) {
+ if (njs_object_slots(&z)) {
+ njs_regexp_exec_result_free(vm, njs_array(&z));
+ }
+
goto done;
}
}

+ if (njs_object_slots(&z)) {
+ njs_regexp_exec_result_free(vm, njs_array(&z));
+ }
+
q = p;
}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Improved memory footprint of RegExp.prototype.split().

Dmitry Volyntsev 315 October 04, 2023 04:56PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 254
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready