memory overflow and memory leak are two different problems, but they are closely related to heap.
Mainly about the JVM memory structure and how to use the scheme.
Memory overflow?Possible causes of memory overflow?Memory overflow solutions, memory leak small series of recommendations for you
Memory overflow?Common memory overflow?The solution of memory overflow
memory overflow: font>
when you apply for 2 bytes, if you use the int type and occupy 4 bytes, there will be memory overflow in this case
possible reasons for memory overflow: font> 1
1. The amount of data loaded in the memory is too large, such as fetching too much data from the database at one time;
2. There are references to objects in the collection class, which are not cleared after use, so that the JVM cannot recycle;
3. There are dead loops in the code or too many duplicate object entities generated by loops;
4. Bugs in the third-party software used;
5. The memory value of the startup parameter is set too small
solution to memory overflow: font>
The first step is to modify the JVM startup parameters to increase the memory directly. (- XMS, – Xmx parameters must not be added. )
Second, check the error log to see if there are other exceptions or errors before the “OUTOFMEMORY” error. (check the next error log)
The third step is to walk through and analyze the code to find out the possible location of memory overflow. (Debug)
The fourth step is to use the memory view tool to dynamically view the memory usage
Memory leak
there are too many static modified variables defined in the project, but these variables are in the permanent area, which may not be recycled regularly by GC. With the accumulation, memory leakage will occur when applying for memory next time.
Suggestions for you
We must not define too many variables in the development process, because the variables modified by static all exist in the permanent area. You can understand the details
JVM memory structure
learn in actual combat and grow in happiness
Read More:
- Fatal error: Newspace:: rebalance allocation failed – process out of memory (memory overflow)
- Out of memory overflow solution for idea running error
- Tomcat memory overflow in Eclipse: Java. Lang. outofmemoryerror: permgen space solution:
- Android avoids memory leak: reasonable use of getcontext() and getapplication ()
- Beego method to find memory leak get memprof
- Memory leak in Windows 8.1 with Killer E2200 and Windows Network Data Usage Monitoring
- Hbase Native memory allocation (mmap) failed to map xxx bytes for committing reserved memory
- Kvm internal error: process exited :cannot set up guest memory ‘pc.ram‘:Cannot allocate memory
- os::commit_memory(0x0000000538000000, 11408506880, 0) failed; error=‘Cannot allocate memory‘
- WebHost failed to process a request.Memory gates checking failed because the free memory (140656640 …
- Mysql cannot allocate memory for the buffer pool solution
- LoadRunner error — memory violation: exception access_ Solution
- RuntimeError: CUDA error: out of memory solution (valid for pro-test)
- Idea pop-up window out of memory, modify the parameters and start the no response solution
- The solution of shared memory real does not exist when Oracle login
- Solution of insufficient memory space or desktop stack in GX works2
- Oracle 11g installation prompt ora-27102: out of memory
- Memory configuration of BIOS combat
- MobaXterm error cuda:out of memory
- Memory error in Python numpy matrix