You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/26 09:52:18 UTC

[GitHub] [doris] muyizi commented on pull request #11040: fix_arena_push_size

muyizi commented on PR #11040:
URL: https://github.com/apache/doris/pull/11040#issuecomment-1195266784

   > 如果 ChunkAllocator 中的 chunk 支持不定长内存的话,那预期存在内存浪费问题,
   > 
   > 按之前的逻辑,申请1624k会实际申请2048k,free时放回2048k的free list中,在之后满足1024k到2048k的内存申请
   > 
   > chunk支持不定长内存的话,第一次申请1624k,free时放回1024k的free list中,在后续当成1024k来用,相比之前一直多浪费400k内存,再次申请1600k时也无法复用上次申请的内存。
   > 
   > 所以我建议 ChunkAllocator 还是保持仅定长内存,否则为了不浪费内存还要加更复杂的比较逻辑,如我上面的patch,对代码健壮性做一些完善,若认可这个思路,可以参考我的patch重新提交下代码~ @muyizi ,若有其他见解欢迎随时沟通~
   
   对应您说的,我认为只支持定长内存其实本质上就不可避免造成内存浪费,用户需要1624k只能去申请2048k,所以我觉得内存浪费这个是一直存在的;
   把allocate不定长的方式不暴露给使用者确实是目前比较简单的方法,但是后面如需使用不定长申请,还是需要改那块逻辑的


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org