以下列表来自2008年的谷歌I/O演讲,称为"Dalvik虚拟机内部",它列出了从最高效率到最低效率循环遍历一组对象的方法:
(1) for (int i = initializer; i >=0; i--) //hard to loop backwards
(2) int limit = calculate_limit(); for (int i= 0; i< limit; i++)
(3) Type[] array = get_array(); for (Type obj : array)
(4) for (int i =0; i< array.length; i++) //gets array.length everytime
(5) for (int i=0; i < this.var; i++) //has to calculate what this.var is
(6) for (int i=0; i < obj.size(); i++) //even worse calls function each time
(7) Iterable list = get_list(); …Run Code Online (Sandbox Code Playgroud) 当我从符号表grep malloc时,使用以下命令
readelf -s bin | grep malloc
Run Code Online (Sandbox Code Playgroud)
我可以看到符号malloc,__ mayoc和__libc_malloc共享相同的代码地址.我可以获取PC地址,想知道用户程序何时调用malloc,但是__malloc和__libc_malloc给了我嘈杂的信息,有什么好办法区分malloc吗?当我用-static编译二进制文件时,所以dlsym在这种情况下不起作用.