------------
using System;
using com.trolltech.qt.gui;
class Test : QWidget
{
const int w = 1000 * 1000 * 10;
public byte[][] Data = new byte[w][];
public Test()
{
for (int x = 0; x < w; x++)
{
Data[x] = new byte[1];
}
show();
GC.Collect(); // so measurements are more accurate
}
protected override void keyPressEvent(QKeyEvent arg__1)
{
disposeLater();
new Test();
}
[STAThread]
static void Main(string[] args)
{
QApplication.initialize(args);
new Test();
QApplication.exec();
}
}
------------
Sorry you are experiencing trouble. I tried to reproduce the issue you
described but could not. Just so we are sure we are on the same page, I
compiled the program like this:
"\Windows\Microsoft.NET\Framework\v3.5\csc.exe" test.cs -r:qtjambi-4.5.2
_01.dll -r:IKVM.OpenJDK.Core.dll /platform:x86
And ran it with test.exe
Immediately the window starts and is closed, no hitting of any keys is doing
anything. When I remove your gc collect and disposeLater calls I get new
windows but of course after some time I get an out of memory exception:
QtJambi: Exception pending in native code in file
'..\cpp\com_trolltech_qt_gui\qtjambishell_QWidget.cpp':746
java.lang.OutOfMemoryError
at cli.Test.<init>(Unknown Source)
at cli.Test.keyPressEvent(Unknown Source)
at IKVM.Runtime.JNIEnv.InvokeHelper(Unknown Source)
at IKVM.Runtime.JNIEnv.CallVoidMethodA(Unknown Source)
at com.trolltech.qt.gui.QApplication.exec(Native Method)
at cli.Test.Main(Unknown Source)
What I'm wondering is what are you doing differently ... when are you
hitting the keys? What version of qt4dotnet / qtjambi are you using?
Best
Frank
> --
> You received this message because you are subscribed to the Google
> Groups "qt4dotnet" group.
> To post to this group, send email to qt4d...@googlegroups.com.
> To unsubscribe from this group, send email to
> qt4dotnet+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/qt4dotnet?hl=en.
With your command line (except with the 4.6.3 Jambi DLL), I get the
same thing as you - immediately the window appears and is closed.
However, my original command line was different. The relevant
difference was that mine had a /debug+ at the end:
"\Windows\Microsoft.NET\Framework\v3.5\csc.exe" test.cs
-r:qtjambi-4.6.3.dll -r:IKVM.OpenJDK.Core.dll /platform:x86 /debug+
And when compiled with /debug+, I get the behavior I described in the
original mail.
So if you compile with /debug+, you'll probably be able to reproduce the leak.
Also, after sending my first mail, I was able to narrow down the
problem to Qt Jambi itself, by porting my testcase to Java. So it's
not actually related to qt4dotnet. I've contacted the Qt Jambi dev and
he's looked at the problem but has been unable to solve it so far.
I've filled two bugreports about it:
http://redmine.smar.fi/issues/134
http://redmine.smar.fi/issues/135
One of them is about the leak, and the other is about a crash I was
getting, which is almost certainly the same crash you are getting.
The crash is pretty random, in that any small change in the test code,
or in the build config, can trigger it or hide it. That's probably the
reason it's triggered by a lack of /debug+.