unable to fork: Cannot allocate memory / core.checkedint / gtkd
number
putimalitze at gmx.de
Sun Feb 11 13:17:13 UTC 2018
I get dmd ouput:
"unable to fork: Cannot allocate memory"
when compiling the following code:
import std.stdio;
import gio.Application : GioApplication = Application;
import gtk.Application;
import gtk.ApplicationWindow;
import gtk.Widget;
import gdk.Keysyms;
int main(string[] args)
{
Application application;
bool onKeyPress(GdkEventKey* eventKey, Widget widget)
{
writeln(GdkKeysyms.GDK_Escape);
return false;
}
void activate(GioApplication app)
{
ApplicationWindow win = new ApplicationWindow(application);
win.addOnKeyPress(&onKeyPress);
win.showAll();
}
application = new Application("org.gtkd.demo.cairo.clock",
GApplicationFlags.FLAGS_NONE);
application.addOnActivate(&activate);
return application.run(args);
}
with this commandline..
dmd -v -L-lgtkd-3 -run test2.d
..it hangs for a some seconds at..
import
core.checkedint (/usr/include/dmd/druntime/import/core/checkedint.d)
..while memory usage grows up to 100%, then continues with other
imports..
code test2
function D main
function test2.main.onKeyPress
function test2.main.activate
function std.stdio.writeln!(GdkKeysyms).writeln
function std.stdio.File.write!(GdkKeysyms, char).write
function std.format.formattedWrite!(LockingTextWriter, char,
GdkKeysyms).formattedWrite
...
then finally..
cc test2.o -o /tmp/dmd_run6k9PhI -m64 -L/usr/lib/x86_64-linux-gnu
-Xlinker --export-dynamic -Xlinker -Bstatic -lphobos2 -Xlinker
-Bdynamic -lpthread -lm -lrt -ldl
unable to fork: Cannot allocate memory
if i comment-out the line..
writeln(GdkKeysyms.GDK_Escape);
then it compiles/links/runs fine.
I actually want to close the application if escape key is pressed
with
if (eventKey.keyval == GdkKeysyms.GDK_Escape) ...
but i don't know if my imports and the event handler are correct,
and i dont know how to close the application yet.
I guess there is something wrong during the compilation process?
DMD64 D Compiler v2.078.1
gtkd import path is in /etc/dmd.conf:
...
[Environment64]
DFLAGS=-I/usr/include/dmd/phobos
-I/usr/include/dmd/druntime/import -I/usr/include/dmd/gtkd3
-L-L/usr/lib/x86_64-linux-gnu -L--export-dynamic -fPIC
...
More information about the Digitalmars-d-learn
mailing list