Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
hikalium
nv
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
MemoryManagement
Jump to bottom
hikalium edited this page
Aug 26, 2016
·
6 revisions
プールシステム
変数プールとしてEListを用いる。
NV_Element構造体に、poolを保持する変数を用意する。
NV_Elementに対し、poolをセットする関数を用意する。
NV_Element_setPool(NV_Pointer e, NV_Pointer pool)
この関数は、removeData(e.pool, e), e.pool=pool, pool.pushData(e)を実行する
EListをfreeする際には、pool==そのリスト、もしくはpool==NULLである子をfreeしてゆく。freeは再帰的に実行される。
削除条件が満たされない要素に関しては、その要素の子については探索しない。
プール設定は、明示的に指定しない限り自動的に上書きされない。つまり、リストに要素を追加しても、その要素の所属プールは追加先のリストとはならない。
ただし、どこにも所属しない要素(e.pool == NULL)ならば、親リストが解放された時に解放されるので、実質的に親リストをプールとしているかのようにあつかわれる。
NV_ListItem, NV_DictItemは、そのアイテムが所属するNV_ListもしくはNV_Dictが解放される時に、poolの設定にかかわらず解放される。
リストのクローン
プールが指定されていない要素に関しては、その要素を複製する。
プールが指定されている要素に関しては、その要素の参照を代入し、実体は複製しない。
リークを防ぐために
新しい領域を、場合によって確保したり確保しなかったりする関数は危険。
実行ツリーに残っていれば後で回収されるが、実行ツリーから外されたデータに関しては、後で回収されない。
実行ツリーから外れているデータはまとめて代入、freeする。
OK
#a = 1
BAD
#a = 1 a = 5
Wiki pages
Pages
12
Loading
Home
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
DataTypes
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
LANG00
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
LANG01
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
LANG02
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Memo
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
MemoryManagement
プールシステム
リストのクローン
リークを防ぐために
OK
BAD
Loading
Node Type とTerm Type
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
prevResearch
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
SimilarityToPlan9
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
Structure
Uh oh!
There was an error while loading.
Please reload this page
.
Loading
グラフをたどる道順のパス表記
Uh oh!
There was an error while loading.
Please reload this page
.
Clone this wiki locally
You can’t perform that action at this time.