New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object.h: migrate alloc_states to mem-pool #857
base: master
Are you sure you want to change the base?
object.h: migrate alloc_states to mem-pool #857
Conversation
/submit |
Submitted as pull.857.git.1612011569489.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
3adcd22
to
e9c1f9e
Compare
/submit |
Submitted as pull.857.v2.git.1612175966786.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, René Scharfe wrote (reply to this):
|
User |
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, 胡哲宁 wrote (reply to this):
|
On the Git mailing list, 胡哲宁 wrote (reply to this):
|
On the Git mailing list, René Scharfe. wrote (reply to this):
|
e9c1f9e
to
4b292c0
Compare
In "object.h",I use `mem_pool` to replace the five "alloc_state *" which used to allocate memory for different types of object nodes.Now that one `mem_pool` unified management of the allocation and release of the memory of multiple nodes. The advantage of changing to a `mem_pool` is: 1.we can allocate more memory at a time than the original `alloc_state`,thus reducing the number of system calls to malloc. 2.the user interface is take memory in a memory pool,We no longer need to take from multiple pools as before. At the same time, mem_pool may have its disadvantages: 1. There is memory fragmentation 2. It is not conducive to counting or traversing different types of nodes. This may require some refinement or disregard. Signed-off-by: ZheNing Hu <adlternative@gmail.com>
/submit |
Submitted as pull.857.v3.git.1612434793195.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
/allow |
Error: User lyrieek is not permitted to use GitGitGadget |
Notice that "mem-pool" api may have similar effort with
alloc_state
,"parsed_object_pool" have five member with
alloc_state
type,and "TODO" usage in "object.h":"migrate alloc_states to mem-pool?",
so let us change it to mem-pool version.
After I learned the role of the memory pool,I think in the future git may be
more inclined to use the memory pool instead of the old interface "alloc_state".
Thanks.
cc: Junio C Hamano gitster@pobox.com
cc: Stefan Beller sbeller@google.com
cc: René Scharfe l.s.r@web.de