Does window minimizing free memory usage

memorywindowwindow-managerx11

Both the undisplayed maximized window and minimized window are invisible to the end user. By undisplayed I mean an inactive maximized window covered by the active window.

There is a difference however—which becomes evident in application-switching services, as with Compiz: the maximized window's appearance is "known" to the Window Manager (hence it can produce a thumbnail), while the minimized window's represented by an icon only (the appearance/content of the window is not computed).

So does this mean memory is freed when a window is minimized? Is there a limit imposed by memory to the number of window a WM can have maximized? If there is such a limitation is it substantial / relevant?

Imagine a WM which does not allow minimizing (but merely switches between maximized windows): would this WM be imposing considerable limitations to the end user because of memory usage?

Thanks for clearing this up—I may have the wrong idea.

Best Answer

Minimizing a window might free a little memory, but it depends on the application, and it won't amount to much. In any case, minimizing won't make more difference than any other form of hiding.

Even if an application's window is minimized, it's still running. The application isn't going to need to keep less data in memory just because one of its windows is minimized.

An application is notified whenever one of its windows is minimized or restored. It's also notified whenever part of its window becomes visible or hidden. It is possible, but unlikely, that the application would react differently to various reasons its window may be hidden:

  • It can be minimized, meaning the window is not shown and an icon is shown in its place.
  • It can be hidden behind other windows (including the full-screen window of a screensaver).
  • It can be displayed on a different desktop, workspace, viewport, or whatever your window manager calls these.
  • It can be hidden in some other manner, for example “shaded” (meaning only a title bar is shown), or simply unmapped (meaning the window manager has decided for whatever reason that the window shouldn't be displayed).

If an application's window is completely hidden, then the application doesn't need to refresh the window contents. If it needs to allocate memory to refresh that content, it won't be doing it while the window is hidden. Also, if a window is hidden (for any reason), the application might free a little memory inside the X server.

What makes more of a difference in practice is that if a window isn't being displayed, then the application doesn't make computations to redraw the contents, and therefore the data needed to draw the contents can be swapped out. If RAM is tight and there's a window you aren't going to iteract with for a while, it's better if the window is not mapped. Again, the reason why the window is not mapped (hidden behind others, minimized, shaded, …) is unimportant.

Related Question