Skip to content

feat: profile memory report/compare + memory snapshot - #171

Merged
yhc509 merged 13 commits into
devfrom
feat/profile-memory
Aug 12, 2026
Merged

yhc509 merged 13 commits into
devfrom
feat/profile-memory

Conversation

@yhc509

@yhc509 yhc509 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

What

메모리 프로파일링 명령 3개를 추가한다. 프레임 시간(profile capture/compare)에 대응하는 메모리 쪽 도구다.

  • profile memory — 메모리 카운터(total/reserved, GC, graphics, audio/video, asset-type별 count·bytes)를 N프레임(기본 30) 샘플링해 min/median/p95/max로 반환하고, Library/com.yhc509.unity-cli-bridge/memory/<reportId>.json sidecar에 저장한다. Unity 버전에 없는 카운터는 실패가 아니라 unavailable로 보고한다.
  • profile memory compare <base> <head> — CLI 로컬 전용. sidecar 두 개를 읽어 Total Used Memory median 기준 verdict(regression/improvement/unchanged, --threshold 기본 5%)와 카운터별 delta를 낸다. Editor가 꺼져 있어도 동작한다.
  • profile memory snapshot — MemoryProfiler.TakeSnapshot으로 .snap을 쓰고 경로+크기+flags만 반환한다. .snap 파싱은 하지 않는다(공개 API 없음). com.unity.memoryprofiler 미설치 시 설치 안내와 함께 거부하고, profile capture와 양방향 single-flight다.

sentinel 규칙(deltaPercentAvailable), 불일치 notes 경고, ordinal tie-break 정렬은 기존 profile compare와 동일하게 맞췄다.

Protocol

wire 명령 2개(profile-memory, profile-memory-snapshot)를 추가하지만 ProtocolVersion은 7 그대로다. 7은 아직 릴리즈되지 않았으므로 추가 bump 없이 편승한다. profile memory compare는 wire 명령이 없다.

Live verification

샘플 프로젝트(headless)에서 실측:

  • profile memory Edit/Play 모두 성공, sidecar 생성 확인. 6000.3에서 GameObject Count만 미지원으로 확인되어 카운터 목록에서 제거했고, 이후 unavailable은 빈 배열이다.
  • profile memory compare — 같은 모드/다른 모드 둘 다 검증. 모드 불일치 시 notes 경고, --limit 초과 시 truncated 확인.
  • 에디터를 완전히 종료한 뒤에도 compare 성공 (transport: cli).
  • profile memory snapshot — 패키지 미설치 시 PROFILE_FAILED + 설치 안내, 설치 후 1.19 GB .snap 생성(1.2초) 확인. capture 진행 중 snapshot은 PROFILE_IN_PROGRESS로 거부됨.
  • headless 무인 파이프라인 완주: editor launch → play → profile memory → stop → editor stop, 사람 개입 없음.

라이브 검증 중 발견해 고친 것 2건: 미지원 카운터 제거, 게이트 메시지의 잘못된 CLI 문법(package add <name> → package add --name <name>).

Tests / docs

  • dotnet test 986 passed / 0 failed
  • scripts/check-unity-meta.sh 통과 (신규 .cs의 .meta는 Unity가 생성한 것을 커밋)
  • doc sync 완료: cli-reference(DocGen --check up to date), README, CLAUDE.md, CHANGELOG 2벌, 스킬 SKILL.md 2벌 + references/profiling.md 2벌(diff 0)

🤖 Generated with Claude Code

https://claude.ai/code/session_01XPBXJjiKtZk6DqEScTpN5D

yhc509 and others added 13 commits August 12, 2026 09:38
…l single-flight

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XPBXJjiKtZk6DqEScTpN5D
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XPBXJjiKtZk6DqEScTpN5D
@yhc509
yhc509 merged commit 7a244c3 into dev Aug 12, 2026
3 checks passed
@yhc509
yhc509 deleted the feat/profile-memory branch August 12, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant