Grails3.3.9 as JSON variable dont GC
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
Thanks for reporting an issue for Grails framework, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.
NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.
Defines a utils class, Used to convert domain instances into Map,
The following code:
`public static def domainFormat(domain) {
def result = domain as JSON
try{
return (Map)JSON.parse(result.toString())
}catch(e){
e.printStackTrace()
}
}`
However, in the production environment variables are not recycled(GC),This often results in full memory and FULL CPU,
Grab the stack memory of the production environment and analyze all points to this public method

### Task List
- [ ] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [ ] Example that reproduces the problem uploaded to Github
- [ ] Full description of the issue provided (see below)
### Steps to Reproduce
1. TODO
defined utils class:
`public static def domainFormat(domain) {
def result = domain as JSON
try{
return (Map)JSON.parse(result.toString())
}catch(e){
e.printStackTrace()
}
}`
2. TODO
def book = Book.get(1)
Map map = domainFormat(book )
map.tttt = "demo"
render map as JSON
3. TODO
### Expected Behaviour
Tell us what should happen
### Actual Behaviour
Tell us what happens instead
### Environment Information
- **Operating System**: win10
- **Grails Version:** 3.3.9
- **JDK Version:** 1.8
- **Container Version (If Applicable):** TODO
### Example Application
- TODO: link to github repository with example that reproduces the issue
Contributor guide
Research direction
Start with the domainFormat utility and the Book.get(1), map modification, and render map as JSON sequence given in the report. Establish a reproducible example and capture the expected and actual memory or GC behavior; the issue is not ready for implementation until those details and an example application are provided.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100