انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-002-L01

كيف تخصص JVM الذاكرة للكائنات

  • الدرس 1 من 7
  • Mid-level
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

explain why allocation is cheap and what it costs later.

الموضوعات المخطط لها

  • Most objects are allocated in the young generation by bumping a pointer inside a thread-local allocation buffer (TLAB); no lock needed.
  • Cheap allocation is why short-lived objects are fine in Java.
  • Allocation rate (MB/s) drives how often the GC runs.
  • Very large objects may go straight to a special region or the old generation (collector-specific).
  • OutOfMemoryError: Java heap space means the live set no longer fits, not that allocation is slow.
تفاصيل المخطط المبدئي

عرض عملي

java
List<OrderLine> lines = new ArrayList<>();   // 1 object, then N OrderLine objects
for (var item : cart) lines.add(new OrderLine(item));

اختبر فهمك

What do you measure to know GC pressure?

أظهر الإجابة

Allocation rate, with GC frequency and pause times.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.