Intern
41. What can cause memory leaks in JAVA applications? * - Improper object management in the heap; - No garbage collector usage; - Incorrect use of static variables; - Excessive use of recursive functions; - Incorrect use of constructors; 42. Types of memory leaks in JAVA applications? * - Through unclosed resources; - Using incorrect data structures; - Incorrect use of garbage collector; - Incorrect use of data streams; 43. What is Docker? *
sobes.tech AI
Answer from AI
Causes of memory leaks in Java:
- Improper management of objects in the heap: objects remain accessible through references even when they are no longer needed, preventing the garbage collector from removing them.
- Incorrect use of static variables: static references live for the entire duration of the application, and if they refer to large objects, memory is not freed.
- Excessive use of recursive functions can lead to stack overflow, but not directly to memory leaks.
Types of memory leaks in Java:
- Through unclosed resources: for example, unclosed streams, database connections, which lead to memory retention.
- Using incorrect data structures: for example, collections that continuously grow and are not cleared.
What is Docker? Docker is a platform for creating, delivering, and running applications in isolated containers. Containers allow packaging an application with all its dependencies, ensuring consistent operation across different environments.