Coldfusion OutOfMemoryError (CF9/Wheels)

后端 未结 2 1685
南方客
南方客 2021-01-24 07:29

I have a function which loops over a query and updates a database row for each item. After about 7000 iterations it\'s throwing an out of memory error - Java heap space. Is ther

相关标签:
2条回答
  • 2021-01-24 08:21

    Don't use cfinvoke to create your Item component every iteration of your fixItems query. Create it once before that using createObject and simply call the updateCode method each time directly on the object.

    0 讨论(0)
  • 2021-01-24 08:28

    The following can be done:

    1. Change your <cfqueryparam> to use the appropriate cf_sql type. Are code and id really strings?

    2. Don't give your <cfquery> a name. You are not keeping the result anyway. var loc doesn't help either

    3. Bump up you memory to the JVM Addtional approach Use Java 7 and G1GC

    4. Every 100 to 1000 iterations do a forced Garbage Collect

    5. Update your data in bulk. XML based table variables can do this.

    6. Make your function silent

    7. Consider ORM on this

    0 讨论(0)
提交回复
热议问题