Skip to content

createTexture重复调用导致内存不足问题 #3

Description

@N0tExpectErr0r

在跟着您的博客学习音视频,在实现图片展示时发现图片显示一段时间消失,查看日志发现下面这条日志不断打印:

GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.

看上去是内存不足导致的,因此检查了下面这段 onDrawFrame 的代码发现每次都会 createTexture,最终导致内存不足:

    @Override
    public void onDrawFrame(GL10 gl) {
            // ...
            textureId = createTexture();
            // ...
    }

尝试改为下面这样以后问题解决:

    @Override
    public void onDrawFrame(GL10 gl) {
            // ...
            if (textureId == 0) {
                textureId = createTexture()
            }
            // ...
    }

因此这里是否应该避免重复 createTexture 呢

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions