Create a black window with as little memory as possible
C, 96KiB
Never seen restricted-memory but i guess code length doesn't matter here. RAM usage was taken from gnome-system-monitor (i hope it's accurate).
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
 
#include &lt;xcb/xcb.h&gt;
 
int main ()
{
  xcb_connection_t    *c;
  xcb_screen_t        *screen;
  xcb_drawable_t       win;
  xcb_generic_event_t *e;
  uint32_t             values[2];
 
  char string[] = &quot; &quot;;
 
  c = xcb_connect (NULL, NULL);
  screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data;
  win = screen-&gt;root;
 
  win = xcb_generate_id(c);
  values[0] = screen-&gt;black_pixel;
  values[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS;
  xcb_create_window (c,XCB_COPY_FROM_PARENT,win,screen-&gt;root,
  0, 0,640,480,10,XCB_WINDOW_CLASS_INPUT_OUTPUT,screen-&gt;root_visual,XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK, values);
 
  xcb_map_window (c, win); 
  xcb_flush (c);
 
  while ((e = xcb_wait_for_event (c))) {
    switch (e-&gt;response_type &amp; ~0x80) {
    case XCB_EXPOSE:
      xcb_flush (c);
      break;
    }
    free (e);
  }
  return 0;
}

This code works on pretty much every linux with a running xserver. To compile add -lxcb for the xcb libs.