{"comment":{"url":"https://api.github.com/repos/serso/exp4j/comments/14521130","html_url":"https://github.com/serso/exp4j/commit/51450a6e0b7ea9f946dcfc7323d57d9964705962#commitcomment-14521130","id":14521130,"user":{"login":"sarxos","id":472658,"avatar_url":"https://avatars.githubusercontent.com/u/472658?v=3","gravatar_id":"","url":"https://api.github.com/users/sarxos","html_url":"https://github.com/sarxos","followers_url":"https://api.github.com/users/sarxos/followers","following_url":"https://api.github.com/users/sarxos/following{/other_user}","gists_url":"https://api.github.com/users/sarxos/gists{/gist_id}","starred_url":"https://api.github.com/users/sarxos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarxos/subscriptions","organizations_url":"https://api.github.com/users/sarxos/orgs","repos_url":"https://api.github.com/users/sarxos/repos","events_url":"https://api.github.com/users/sarxos/events{/privacy}","received_events_url":"https://api.github.com/users/sarxos/received_events","type":"User","site_admin":false},"position":6,"line":38,"path":"src/main/java/net/objecthunter/exp4j/Expression.java","commit_id":"51450a6e0b7ea9f946dcfc7323d57d9964705962","created_at":"2015-11-20T08:47:57Z","updated_at":"2015-11-20T08:47:57Z","body":"I haven't check this in details, but at the first glance this solution makes ```Expression``` non thread-safe in case when evaluation for a different arguments is done in parallel. Having ```ThreadLocal<double[][]>``` with custom initializer would be more appropriate here, but I'm not sure what about such solution performance.\r\n\r\n```java\r\nprivate final ThreadLocal<double[][]> arrays = new ThreadLocal<double[][]>() {\r\n\r\n\t@Override\r\n\tprotected double[][] initialValue() {\r\n\t\tdouble[][] arrays = new double[4][];\r\n\t\tfor (int i = 0; i < arrays.length; i++) {\r\n\t\t\tarrays[i] = new double[i];\r\n\t\t}\r\n\t\treturn arrays;\r\n\t}\r\n};\r\n```\r\n"}}