diff --git a/core/src/main/java/lucee/runtime/type/UDFImpl.java b/core/src/main/java/lucee/runtime/type/UDFImpl.java index fd4bc7f62d..efac8a2e9a 100755 --- a/core/src/main/java/lucee/runtime/type/UDFImpl.java +++ b/core/src/main/java/lucee/runtime/type/UDFImpl.java @@ -303,7 +303,11 @@ else if (cacheHandler != null) { // TODO this else block can be removed when all private Object _call(PageContext pc, Collection.Key calledName, Object[] args, Struct values, boolean doIncludePath, Argument newArgs) throws PageException { PageContextImpl pci = (PageContextImpl) pc; boolean existingNewArgs = newArgs != null; - if (!existingNewArgs) newArgs = pci.getScopeFactory().getArgumentInstance(); + + if (!existingNewArgs){ + if (args == null) newArgs = pci.getScopeFactory().getArgumentInstance(); + else newArgs = pci.getScopeFactory().getArgumentInstance(args.length); + } newArgs.setFunctionArgumentNames(properties.getArgumentsSet()); LocalImpl newLocal = pci.getScopeFactory().getLocalInstance(); diff --git a/core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java b/core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java index 702b0d2fff..38d6cb4d1c 100755 --- a/core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java +++ b/core/src/main/java/lucee/runtime/type/scope/ArgumentImpl.java @@ -70,7 +70,12 @@ public final class ArgumentImpl extends ScopeSupport implements Argument, ArrayP */ public ArgumentImpl() { // super("arguments", SCOPE_ARGUMENTS, StructImpl.TYPE_LINKED, 4); - super("arguments", SCOPE_ARGUMENTS, StructImpl.TYPE_LINKED_NOT_SYNC, 8); + super("arguments", SCOPE_ARGUMENTS, StructImpl.TYPE_LINKED_NOT_SYNC, 4); + } + + public ArgumentImpl(int size) { + // super("arguments", SCOPE_ARGUMENTS, StructImpl.TYPE_LINKED, 4); + super("arguments", SCOPE_ARGUMENTS, StructImpl.TYPE_LINKED_NOT_SYNC, size); } @Override diff --git a/core/src/main/java/lucee/runtime/type/scope/ScopeFactory.java b/core/src/main/java/lucee/runtime/type/scope/ScopeFactory.java index 6a91e3dedc..76549a064f 100755 --- a/core/src/main/java/lucee/runtime/type/scope/ScopeFactory.java +++ b/core/src/main/java/lucee/runtime/type/scope/ScopeFactory.java @@ -21,6 +21,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; import lucee.runtime.PageContext; +//import lucee.aprint; /** * creates Local and Argument scopes and recyle it @@ -38,24 +39,35 @@ public final class ScopeFactory { * @return returns an Argument scope */ public Argument getArgumentInstance() { - /* Argument arg = arguments.poll(); if (arg != null) { return arg; } - */ + //aprint.o("arguments new! " + arguments.size()); return new ArgumentImpl(); } + /** + * @return returns an Argument scope + */ + public Argument getArgumentInstance(int size) { + Argument arg = arguments.poll(); + if (arg != null) { + return arg; + } + //aprint.o("arguments new! " + arguments.size()); + return size > 3 ? new ArgumentImpl(8) : new ArgumentImpl(); + } + /** * @return retruns a Local Instance */ public LocalImpl getLocalInstance() { - /* LocalImpl lcl = locals.poll(); + LocalImpl lcl = locals.poll(); if (lcl != null) { return lcl; } - */ + //aprint.o("local new! " + locals.size()); return new LocalImpl(); } @@ -63,24 +75,20 @@ public LocalImpl getLocalInstance() { * @param argument recycle an Argument scope for reuse */ public void recycle(PageContext pc, Argument argument) { - return; - /* if (arguments.size() >= MAX_SIZE || argument.isBind()) return; + //if (argument.size() > 0) aprint.o("arg: " + argument.size()); argument.release(pc); arguments.add(argument); - */ } /** * @param local recycle a Local scope for reuse */ public void recycle(PageContext pc, LocalImpl local) { - return; - /* if (locals.size() >= MAX_SIZE || local.isBind()) return; + //if (local.size() > 0) aprint.o("local: " + local.size()); local.release(pc); locals.add(local); - */ } /**