konsumer / konsumer/raylib-pointers

Potential memory leak

未关闭
#12 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C
星标
0
派生
1
PR 合并指标
30 天内没有已合并 PR

描述

It seems memory will be leaked if you allocate more pointers than `FRAME_ALLOC_SIZE`, or `1024*512`, or `524,288`.
https://github.com/konsumer/raylib-pointers/blob/7f2340c4b82fd13e4f00fe682c8b234e3b043ae9/tools/gen_lib.js#L52

Here's where you free only up to `_frame_alloc_counter`.
https://github.com/konsumer/raylib-pointers/blob/7f2340c4b82fd13e4f00fe682c8b234e3b043ae9/tools/gen_lib.js#L63

A few solutions off the top of my head:
1. Show some warning when reaching the limit to make the memory leak obvious.
2. Remove `FRAME_ALLOC_SIZE` altogether. I think a good way to do that is to only ever have one pointer allocated that'll be used to carry the result, but is freed on the next raylib-function call. Then the receiving/duping/allocating can be done by JS on the JS side, instead of the C side.

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 tools/gen_lib.js 中第 52 行附近的分配和第 63 行附近的清理开始。跟踪分配超过 FRAME_ALLOC_SIZE 时会发生什么,然后确定项目应该在达到限制时发出警告,还是移除固定分配方案。完成的标准是:超额分配情况不再静默泄漏,并且所选择的行为已记录或验证。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, javascript
领域
tooling
Issue 类型
缺陷
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。