On 13/02/2007, at 12:50 PM, Jeff Ayling wrote:
Hi all,
My app built with RB2007r1 on osx ppc and running on osx ppc seems
to hard crash from time to time without warning and without a crash
report.
I am trying to debug and I now have a window with the following
code which allows me to view all objects, their ids and number of
references:
Dim i, total as Integer
total=Runtime.ObjectCount
For i=0 to total-1
Listbox1.addrow Str(Runtime.ObjectID(i))
Listbox1.Cell(ListBox1.LastIndex,1)=Runtime.ObjectClass(i)
Listbox1.Cell(ListBox1.LastIndex,2)= Str(Runtime.ObjectRefs(i))
Next
EditField1.text= Str(Runtime.memoryUsed)
Is there any way of getting some more information about each
object? One object called "TextEncoding" has an increasing number
of references while the app is running - it's now up to 1800
references after 24 hours and growing. Is there anyway of locating
this object within my code? I have its object id which gets added
to the listbox - can that help me to locate the object in my code?
Thanks
Jeff
Hi all,
Ok, I have found the reason for the TextEncoding Object rapidly
increasing number of references but I'm not sure if this is normal,
bad coding or if this is even a problem.
I created a new project with a timer containing the following code:
dim f as folderitem
dim fi as textinputstream
dim s as string
f=GetFolderItem("notes.txt")
fi=f.OpenAsTextFile
s=fi.ReadAll
fi.close
f=Nil
fi=Nil
So, every time the fi.ReadAll reads the file a new TextEncoding
reference is added to the stack. Using the code from my original
post, the Runtime.ObjectRefs for TextEncoding increases by 1 each
time the ReadAll is called. Pop it in a Timer with 1 millisecond loop
and this grows to over 20,000 references within a few seconds.
Is this ok? Is this a problem that there are sooo many references to
textencoding even after the object is no longer needed?
Thanks
Jeff
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>