Files
progcode/web/public/visuals/v2/d-gc-reachability.svg
T

1 line
4.7 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" width="640" height="1040" viewBox="0 0 640 1040" role="img" aria-labelledby="title desc"><title id="title">Пулы памяти и mark-sweep</title><desc id="desc">Корневые ссылки ведут к объектам в пулах. При маркировке обходятся достижимые объекты. Недостижимый объект становится кандидатом на освобождение; освобождённый блок снова доступен выделителю.</desc><defs><marker id="arrow" markerWidth="9" markerHeight="9" refX="7" refY="4" orient="auto"><path d="M0 0 8 4 0 8" fill="none" stroke="#b64d26" stroke-width="1.6"/></marker><pattern id="hatch" width="9" height="9" patternUnits="userSpaceOnUse"><path d="M-2 2 2-2 M0 9 9 0 M7 11 11 7" stroke="#d8d0c0" stroke-width="2"/></pattern></defs><rect width="640" height="1040" rx="4" fill="#fbf8f1"/><g font-family="Arial,Helvetica,sans-serif" fill="#242824"><text x="32" y="44" font-size="20" font-weight="bold" fill="#b64d26" text-anchor="start" font-family="monospace">04 / D GC</text><text x="32" y="87" font-size="33" font-weight="bold" fill="#242824" text-anchor="start">От ссылок — к свободным блокам</text><text x="32" y="122" font-size="24" font-weight="normal" fill="#676961" text-anchor="start">Упрощённая модель mark–sweep.</text><path d="M32 148 H608" fill="none" stroke="#d8d0c0" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><rect x="32" y="179" width="576" height="80" rx="10" fill="#242824" stroke="#242824" stroke-width="2"/><text x="320" y="230" font-size="27" font-weight="normal" fill="#fbf8f1" text-anchor="middle">Корни: стек, регистры, данные</text><path d="M200 260 V344" fill="none" stroke="#b64d26" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#arrow)"/><path d="M440 260 V344" fill="none" stroke="#b64d26" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#arrow)"/><rect x="32" y="368" width="576" height="267" rx="10" fill="#efe9dd" stroke="#242824" stroke-width="2"/><text x="54" y="408" font-size="22" font-weight="bold" fill="#b64d26" text-anchor="start">ПУЛ ПАМЯТИ</text><circle cx="155" cy="486" r="47" fill="#fbf8f1" stroke="#242824" stroke-width="2"/><text x="155" y="497" font-size="35" font-weight="bold" fill="#242824" text-anchor="middle">A</text><circle cx="189" cy="452" r="12" fill="#b64d26" stroke="#b64d26" stroke-width="2"/><circle cx="454" cy="486" r="47" fill="#fbf8f1" stroke="#242824" stroke-width="2"/><text x="454" y="497" font-size="35" font-weight="bold" fill="#242824" text-anchor="middle">B</text><circle cx="488" cy="452" r="12" fill="#b64d26" stroke="#b64d26" stroke-width="2"/><path d="M203 486 H395" fill="none" stroke="#b64d26" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#arrow)"/><text x="300" y="468" font-size="22" font-weight="normal" fill="#676961" text-anchor="middle">ссылка</text><rect x="68" y="563" width="213" height="43" rx="10" fill="url(#hatch)" stroke="#d8d0c0" stroke-width="2"/><text x="174" y="592" font-size="23" font-weight="normal" fill="#676961" text-anchor="middle">свободно</text><circle cx="454" cy="575" r="32" fill="#fbf8f1" stroke="#d8d0c0" stroke-width="2"/><text x="454" y="585" font-size="27" font-weight="normal" fill="#676961" text-anchor="middle">C</text><path d="M491 551 l24 24 M515 551 l-24 24" fill="none" stroke="#b64d26" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><text x="32" y="683" font-size="24" font-weight="bold" fill="#b64d26" text-anchor="start" font-family="monospace">01 MARK</text><text x="32" y="719" font-size="26" font-weight="normal" fill="#242824" text-anchor="start">От корней отмечаем A и B.</text><text x="32" y="756" font-size="25" font-weight="normal" fill="#676961" text-anchor="start">До C нет пути по найденным ссылкам.</text><path d="M320 781 V822" fill="none" stroke="#b64d26" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#arrow)"/><rect x="32" y="845" width="576" height="111" rx="10" fill="#efe9dd" stroke="#242824" stroke-width="2"/><text x="54" y="882" font-size="24" font-weight="bold" fill="#b64d26" text-anchor="start" font-family="monospace">02 SWEEP</text><text x="54" y="922" font-size="25" font-weight="normal" fill="#242824" text-anchor="start">Блок C возвращается в свободные.</text><text x="32" y="1004" font-size="23" font-weight="normal" fill="#676961" text-anchor="start">Финализаторы и ложные ссылки усложняют сборку.</text></g></svg>