[原创]xposedjnitrace | 宜武汇-ag真人国际厅网站

private void startserialization(context context) {

    try {

        //手动触发gc,清空多余实例

        system.gc();

        final file file = new file("/data/data/"

                 mtagpackagename "/" mprocessname "_memoryserializationinfo.txt");

        if (file.exists()) {

            file.delete();

        }

        file.createnewfile();

        //子线程和主线程共享数据

        threadutils.runonnonuithread(() -> {

            arraylist<object> choose = chooseutils.choose(object.class, true);

            int size = choose.size();

            clog.e("memory object size -> " size);

            for (int index = 0; index < size; index ) {

                object obj = choose.get(index);

                string objstr = gsonutils.obj2str(obj);

                if (objstr != null) {

                    string objclassname = obj.getclass().getname();

                    string infostr = index "/" size "[" mprocessname "]" objclassname " " objstr "\n";

                    //增加效率暂不打印进度

                    //printfprogress(size,index,context);

                    //toastutils.showtoast(context,"memoryserialization[" index "/" size "]");

                    clog.i(infostr);

                    fileutils.savestringnoclose(infostr, file);

                }

            }

            fileutils.savestringclose();

        }, 30 * 1000);

    } catch (throwable e) {

        clog.e("startserialization error " e);

    }

原文链接:https://bbs.kanxue.com/thread-276715.htm

网络摘文,本文作者:15h,如若转载,请注明出处:https://www.15cov.cn/2023/08/27/原创xposedjnitrace/

发表评论

邮箱地址不会被公开。 必填项已用*标注

网站地图