问题描述
我得到这个错误数百次,当我在调试运行,它似乎不影响程序,但如何摆脱它?
I get this error hundreds of times when I run in Debug, it doesn't seem to affect the program, but how do I get rid of it?
我知道这是可以追溯到的Soundpool基于其他职位
I know it can be traced back to the SoundPool based on other posts
9月9日至15日:03:09.190:ERROR / AudioCache(34):堆大小溢出! REQ大小:1052672,最大尺寸:1048576
09-15 09:03:09.190: ERROR/AudioCache(34): Heap size overflow! req size: 1052672, max size: 1048576
推荐答案
的Soundpool为c缓冲区大小为1M所有加载的文件很难$ C $。所以,你可能会得到堆大小溢出错误,当您加载太多的文件到的Soundpool。我也有一个游戏项目,将加载游戏的声音效果到的Soundpool这个问题和解决方法如下:
SoundPool is hard code the buffer size as 1M for all loaded file. So you probably will get 'heap size overflow' error when you load too much files into SoundPool. I also have this issue on a game project that will load game sound FX into SoundPool and the solution is as follow:
- 在播放长/大的背景音乐中的MediaPlayer。
- 播放多的Soundpool情况下,短期的声音文件,以prevent堆错误。样品code多SoundPools:
/**
* Multi SoundPool to prevent memory error.
*/
public class SoundPools {
这篇关于机器人的Soundpool堆大小溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!