Home >Java >JavaBase >The difference between java heap and stack

The difference between java heap and stack

王林
王林Original
2019-11-09 17:58:314972browse

The difference between java heap and stack

The difference between heap and stack:

1. Stack memory stores local variables while heap memory stores entities;

2. Stack The update speed of memory is faster than that of heap memory, because the life cycle of local variables is very short;

3. The variables stored in stack memory will be released once their life cycle ends, while the entities stored in heap memory will be garbage The recycling mechanism recycles from time to time.

Recommended tutorial: java tutorial

The above is the detailed content of The difference between java heap and stack. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn