vlsi commented on PR #5916:
URL: https://github.com/apache/jmeter/pull/5916#issuecomment-1546548321

   It looks like another API is needed so the component can figure out if the 
actual element has been cloned or not.
   
   For instance, in case like https://github.com/apache/jmeter/pull/727, 
`HeaderManager#assertMutable()` should be able to tell if the specific 
`HeaderManager` is cloned or not.
   If a code creates a temporary `HeaderManager` object for the purpose of 
merging the headers, then the temporary `HeaderManager` should not fail with 
something like "oh, this is a shared instance, stop modifying it".
   
   It sounds like `NoThreadClone#freeze()` method which would signal the 
component the instance is reused.
   
   Then `TreeCloner` would call `freeze` on non-cloned objects.
   
   ---
   
   Unfortunately, it reminds me of the new memory management in Kotlin Native : 
https://kotlinlang.org/docs/native-migration-guide.html
   Initially, they had a memory model which the user must call `freeze` object 
before sharing the object cross-threads.
   That memory model has proven to be hard to use, and they went with a garbage 
collector.
   Even though our goals are slightly different, it sounds related.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to