gpt4 book ai didi

c# - 帮助破译 logcat 输出 - 过多的 JNI 全局引用

转载 作者:行者123 更新时间:2023-11-29 22:24:18 24 4
gpt4 key购买 nike

谁能给我任何提示,说明是什么导致我的应用程序中止并给出此输出?

I/ActivityManager(   68): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=MapDroid.MapDroid/mapdroid.StudentList } from pid 223
I/ActivityManager( 68): Start proc MapDroid.MapDroid for activity MapDroid.MapDroid/mapdroid.StudentList: pid=506 uid=10036 gids={3003}
I/ActivityThread( 506): Pub MapDroid.MapDroid.__mono_init__: mono.MonoRuntimeProvider
D/dalvikvm( 506): Trying to load lib /data/data/MapDroid.MapDroid/lib/libmonodroid.so 0x40512d80
D/dalvikvm( 506): Added shared lib /data/data/MapDroid.MapDroid/lib/libmonodroid.so 0x40512d80
D/dalvikvm( 506): GC_CONCURRENT freed 1219K, 57% free 2906K/6727K, external 1625K/2137K, paused 19ms+5ms
I/ActivityManager( 68): Displayed MapDroid.MapDroid/mapdroid.StudentList: +16s949ms
D/dalvikvm( 223): GC_EXPLICIT freed 41K, 50% free 2940K/5767K, external 5937K/7285K, paused 88ms
D/dalvikvm( 506): GC_EXPLICIT freed 177K, 56% free 2976K/6727K, external 1671K/2137K, paused 71ms
D/dalvikvm( 506): GC_FOR_MALLOC freed 2K, 56% free 2974K/6727K, external 1671K/2137K, paused 50ms
I/dalvikvm-heap( 506): Grow heap (frag case) to 7.125MB for 22008-byte allocation
D/dalvikvm( 506): GC_FOR_MALLOC freed 0K, 56% free 2995K/6791K, external 1671K/2137K, paused 72ms
D/dalvikvm( 506): GREF has increased to 201
D/dalvikvm( 506): GREF has increased to 301
D/dalvikvm( 506): GREF has increased to 401
D/dalvikvm( 506): GREF has increased to 501
D/dalvikvm( 506): GREF has increased to 601
D/dalvikvm( 506): GREF has increased to 701
D/dalvikvm( 506): GREF has increased to 801
D/dalvikvm( 506): GREF has increased to 901
D/dalvikvm( 506): GREF has increased to 1001
D/dalvikvm( 506): GREF has increased to 1101
D/dalvikvm( 506): GREF has increased to 1201
D/dalvikvm( 506): GREF has increased to 1301
D/dalvikvm( 506): GREF has increased to 1401
D/dalvikvm( 506): GREF has increased to 1501
D/dalvikvm( 506): GREF has increased to 1601
D/dalvikvm( 506): GREF has increased to 1701
D/dalvikvm( 506): GREF has increased to 1801
D/dalvikvm( 506): GREF has increased to 1901
D/dalvikvm( 506): GREF has increased to 2001
W/dalvikvm( 506): Last 10 entries in JNI global reference table:
W/dalvikvm( 506): 1991: 0x40567bf0 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 1992: 0x40567c00 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 1993: 0x40567b60 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 1994: 0x40567b70 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 1995: 0x40567b80 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 1996: 0x40561ab8 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 1997: 0x40561ac8 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 1998: 0x40561ad8 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 1999: 0x4055eef0 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): 2000: 0x4055ef00 cls=Lmono/android/runtime/JavaObject; (12 bytes)
W/dalvikvm( 506): JNI global reference table summary (2001 entries):
W/dalvikvm( 506): 50 of Ljava/lang/Class; 164B (40 unique)
W/dalvikvm( 506): 47 of Ljava/lang/Class; 188B (17 unique)
W/dalvikvm( 506): 6 of Ljava/lang/Class; 212B (6 unique)
W/dalvikvm( 506): 11 of Ljava/lang/Class; 236B (6 unique)
W/dalvikvm( 506): 2 of Ljava/lang/Class; 260B (2 unique)
W/dalvikvm( 506): 5 of Ljava/lang/Class; 284B (2 unique)
W/dalvikvm( 506): 6 of Ljava/lang/Class; 308B (5 unique)
W/dalvikvm( 506): 3 of Ljava/lang/Class; 332B (2 unique)
W/dalvikvm( 506): 1 of Ljava/lang/Class; 356B
W/dalvikvm( 506): 2 of Ljava/lang/Class; 380B (1 unique)
W/dalvikvm( 506): 2 of Ljava/lang/Class; 428B (2 unique)
W/dalvikvm( 506): 1 of Ljava/lang/Class; 452B
W/dalvikvm( 506): 1 of Ljava/lang/Class; 476B
W/dalvikvm( 506): 1 of Ljava/lang/Class; 500B
W/dalvikvm( 506): 1 of Ljava/lang/Class; 548B
W/dalvikvm( 506): 1 of Ljava/lang/Class; 572B
W/dalvikvm( 506): 2 of Ljava/lang/Class; 596B (2 unique)
W/dalvikvm( 506): 1 of Ljava/lang/Class; 692B
W/dalvikvm( 506): 1 of Ljava/lang/Class; 1004B
W/dalvikvm( 506): 2 of Ljava/lang/Class; 1172B (2 unique)
W/dalvikvm( 506): 1 of Ljava/lang/Class; 1316B
W/dalvikvm( 506): 1 of Ljava/lang/Class; 3452B
W/dalvikvm( 506): 1 of Ljava/lang/String; 28B
W/dalvikvm( 506): 2 of Ldalvik/system/VMRuntime; 12B (1 unique)
W/dalvikvm( 506): 9 of Ljava/lang/ref/WeakReference; 28B (9 unique)
W/dalvikvm( 506): 1 of Ljava/lang/ref/WeakReference; 36B
W/dalvikvm( 506): 1 of Ldalvik/system/PathClassLoader; 44B
W/dalvikvm( 506): 1 of Landroid/app/ActivityThread$ApplicationThread; 28B
W/dalvikvm( 506): 1 of Landroid/content/ContentProvider$Transport; 28B
W/dalvikvm( 506): 1 of Landroid/view/inputmethod/InputMethodManager$ControlledInputConnectionWrapper; 36B
W/dalvikvm( 506): 1 of Landroid/view/ViewRoot$1; 12B
W/dalvikvm( 506): 1 of Landroid/view/ViewRoot$W; 28B
W/dalvikvm( 506): 1 of Landroid/view/inputmethod/InputMethodManager$1; 28B
W/dalvikvm( 506): 1 of Landroid/view/accessibility/AccessibilityManager$1; 28B
W/dalvikvm( 506): 2 of Lorg/apache/harmony/xnet/provider/jsse/TrustManagerImpl; 28B (1 unique)
W/dalvikvm( 506): 1 of Lmapdroid/StudentList_GetStudentsTask; 28B
W/dalvikvm( 506): 1099 of Lmono/android/runtime/JavaObject; 12B (1099 unique)
W/dalvikvm( 506): 729 of Lmono/android/runtime/JavaObject; 20B (729 unique)
W/dalvikvm( 506): 1 of Lmapdroid/StudentList; 180B
W/dalvikvm( 506): Memory held directly by tracked refs is 58440 bytes
E/dalvikvm( 506): Excessive JNI global references (2001)
E/dalvikvm( 506): VM aborting
D/Zygote ( 33): Process 506 exited cleanly (1)
I/ActivityManager( 68): Process MapDroid.MapDroid (pid 506) has died.
I/WindowManager( 68): WIN DEATH: Window{406a8598 MapDroid.MapDroid/mapdroid.StudentList paused=false}
W/InputManagerService( 68): Got RemoteException sending setActive(false) notification to pid 506 uid 10036

StudentList.cs 代码

using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using MonoMap;
using MonoMap.wsMobile;

namespace MapDroid
{
public class StudentList : Activity
{

private int currentFacultyId = 93306;

protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

//Show Loading Layout
SetContentView(Resource.Layout.SplashLoad);

// init AsycTask and Execute
GetStudentsTask gstask = new GetStudentsTask(this, currentFacultyId);
gstask.Execute();

}

/***
* Callback after GetStudentsTask completes
*
**/
protected void ShowList(ArrayAdapter<Student> adapter)
{
SetContentView(Resource.Layout.LayoutStudentList);

//Grab Views
ListView lvStudent = FindViewById<ListView>(Resource.Id.studentListView);
EditText etFilter = FindViewById<EditText>(Resource.Id.studentFilter);

//Attach Adapter to ListView
lvStudent.Adapter = adapter;

//Use delegate to filter list on TextChanged
etFilter.TextChanged += delegate(object sender, Android.Text.TextChangedEventArgs e)
{
adapter.Filter.InvokeFilter(e.Text.ToString());
};

//Use delagate to fire intent on ItemClick
lvStudent.ItemClick += delegate(object sender, ItemEventArgs args)
{
Student selectedStudent = adapter.GetItem(args.Position);
Intent intent = new Intent(this, typeof(TabbedView));
intent.PutExtra("studentId", selectedStudent.I.ToString());
intent.PutExtra("studentName", selectedStudent.F.ToString() + " " + selectedStudent.L.ToString());
intent.PutExtra("facultyId", currentFacultyId.ToString());
StartActivity(intent);
};
}

/**
* AsycTask Implementation to Get All Associated Students
*
*/
internal class GetStudentsTask : AsyncTask
{

private ArrayAdapter<Student> _adapter;
private StudentList _outer;
private int _facId;

public GetStudentsTask(StudentList outer, int currentFacultyId)
{
this._outer = outer;
this._facId = currentFacultyId;
}

protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params)
{
//Setup Adapter Data Source
Student[] students = WebService.GetStudentListbyFacultyId(_facId);
_adapter = new ArrayAdapter<Student>(_outer, Resource.Layout.ItemStudent, students);
return true;
}

protected override void OnPostExecute(Java.Lang.Object result)
{
_outer.ShowList(_adapter);
base.OnPostExecute(result);
}
}
}
}

另一个奇怪的问题是它可以在实际设备上正常运行,但在模拟器上运行时它会给出这个输出并中止...

想法?

最佳答案

模拟器上的全局引用限制是 2000。如果我没记错的话,在设备上是 ~52000。您正在做的事情是创建和持有过多的对象。

关于c# - 帮助破译 logcat 输出 - 过多的 JNI 全局引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6373549/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com