相关文章推荐
英勇无比的核桃  ·  CSS3 ...·  2 年前    · 
体贴的小刀  ·  Spring Boot ...·  3 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Now does the lst in preprocessor uses the same memory of lst in jsr223 sampler or it creates its new memory and uses. Q2) Another question is, does the lst memory in preprocessor gets cleared for every iteration or does it created new memory for each iteration.

In your setup you always refer to the same object which lives in JMeterVariables class instance, it neither allocates new portion of memory nor frees it during new iterations.

However be aware that each JMeter thread (virtual user) will have this object in its local storage so for 1 thread you will have 1 instance, for 2 threads - 2 instances.

So if you have > 1 thread and use the same object across all threads - it's better to use props instead of vars, as per documentation :

Properties are not the same as variables. Variables are local to a thread; properties are common to all threads

If you want to clear the object manually use vars.remove() function where needed like:

vars.remove('lst')
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.