Garbage Collection in ColdFusion CFC

I have CFC as a single object in the application area.

One of the methods is used for massive data processing and periodically causes Java heap space errors.

EDIT All the variables inside the VAR region method, so they should not be stored in the object region at the end of the call.

This might be a bit of a dumb question for Java people, but I would like to know how the Java garbage collector clears the memory of CFC methods: only when the whole request is completed or maybe right after every method / function call

The second option is interesting in that it allows me to divide my large method into several, as one of the possible optimizations.

+4
source share
2 answers

it is well known that coldfusion will not collect garbage until the current request has been processed, even if you try to call it manually.

+2
source

Java releases resources after there is no reference to the object. You have a Singleton application scope object, which actually means that it will never issue instance variables and class variables. In addition, you will do this manually in your code. You should show the code to get more tips on how to optimize your code.

+1
source

Source: https://habr.com/ru/post/1304175/


All Articles