新建一个test项目,用xcode打包,调试,项目能够正常跑起来,在双击home后从后台强制退出,会报错,报错的内容为
ScriptingCore::removeAllRoots(JSContext *cx)方法里的 _native_js_global_map.clear();
发现是这个unordered_map 类型调用clear方法出错,log如下:
{
gl.supports_OES_map_buffer: true
gl.supports_vertex_array_object: true
cocos2d.x.version: cocos2d-x-3.16
gl.vendor: Apple Inc.
gl.supports_PVRTC: true
gl.renderer: Apple Software Renderer
cocos2d.x.compiled_with_profiler: false
gl.supports_S3TC: false
gl.version: OpenGL ES 2.0 APPLE-14.0.15
cocos2d.x.build_type: DEBUG
gl.max_texture_size: 4096
gl.supports_ETC1: false
gl.supports_BGRA8888: false
gl.max_texture_units: 8
gl.max_samples_allowed: 4
gl.supports_OES_packed_depth_stencil: true
gl.supports_ATITC: false
gl.supports_NPOT: true
gl.supports_discard_framebuffer: true
cocos2d.x.compiled_with_gl_state_cache: true
gl.supports_OES_depth24: true
}
cocos2d: fullPathForFilename: No file found at script/jsb_prepare.jsc. Possible missing file.
cocos2d: fullPathForFilename: No file found at script/jsb_boot.jsc. Possible missing file.
Cocos2d-JS v3.16
2017-11-13 14:24:37.467 testapp-mobile[10114:56465] cocos2d: surface size: 1136x640
libpng warning: iCCP: known incorrect sRGB profile
cocos2d: QuadCommand: resizing index size from [-1] to [2560]
2017-11-13 14:24:37.687 testapp-mobile[10114:56465] cocos2d: surface size: 1136x640
testapp-mobile(10114,0x1167903c0) malloc: *** error for object 0x608000226ac0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug