# Maximising Window on x64 build

**URL:** <https://discourse.glfw.org/t/maximising-window-on-x64-build/694>\
**Category:** support\
**Created:** [June 30, 2016, 1:24pm UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694 "2016-06-30T13:24:21Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![rNdm74](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/rndm74/32/43_2.png) [@rNdm74](https://discourse.glfw.org/u/rNdm74)\
**Post date:** [June 30, 2016, 1:24pm UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/1 "2016-06-30T13:24:21Z")

</div>

When running a standard GLFW Window on x86 platform.

**Task:** Resize window in windowed mode to full screen.  
**Observation:** Memory usage stays the same about 20mb.

**Problem:** On x64 build platform.  
**Task:** Resizing window in windowed mode to full screen.  
**Observation:** Memory usage jumps from about 50mb to 160mb.

Has anyone had this problem before and if so could you please help me with this.

Kind regards,

Adam

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [July 1, 2016, 8:47am UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/2 "2016-07-01T08:47:53Z")

</div>

Is this causing any problems?

What OS are you using?

Have you tracked down where the memory is being allocated (in the OpenGL driver, by GLFW, in your own code etc.)?

---

<div class="post-metadata">

**Author:** ![rNdm74](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/rndm74/32/43_2.png) [@rNdm74](https://discourse.glfw.org/u/rNdm74)\
**Post date:** [July 2, 2016, 4:15am UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/3 "2016-07-02T04:15:45Z")

</div>

Thanks for the reply.

This is a a synthetic test, monitoring memory usage of a GLFW window on x86 build vs x64 build.

Using Windows 10 x64, with Visual Studio 14, however OS and IDE is irrelevant.

The problem seems to be the result of a window resize regardless of the size of the window.

**Test Code in Question:**

![](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/d57454f6ddd8bd6a74ce5550b9a19110abd5ab64.jpg)

_Have you tracked down where the memory is being allocated (in the OpenGL driver, by GLFW, in your own code etc.)_  
No

Any suggestions would be much appreciated.

Kind regards,

Adam

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [July 2, 2016, 9:20am UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/4 "2016-07-02T09:20:39Z")

</div>

Hi Adam,

Since you’re program is a synthetic test to monitor memory usage, and you’ve successfully run and monitored memory usage, it seems to me you don’t have a problem other than an interest in trying to understand what’s going on.

The OS and compiler toolchain are actually quite important.

Since you’re using Visual Studio 2015 (VS 14.0) you can use [the memory heap profiling tool](https://blogs.msdn.microsoft.com/vcblog/2015/10/21/memory-profiling-in-visual-c-2015/) to investigate. Run your program and take a snapshot just before you resize, and then resize and take another snapshot so you can look at the difference. Make sure that you have debug information in your build (i.e. a release build but generating a pdb) and that you’re targeting the v140 platform toolset (this should be standard).

In my case what I see is that although the memory of the process changes when I change the size of the window or go fullscreen, the application itself and glfw are not allocating any memory as the heap snapshots show.

Using [Process Explorer](https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx?f=255&MSPPError=-2147217396) I can see that the GPU memory is going up at the same time as the overall Private Data, so it’s probable that the driver or WDDM is responsible. Looking at the 32 bit build I see that although the GPU memory increases, the private data doesn’t go up much.

You might wonder why there’s a difference between the 32 and 64 bit versions, and it’s possible this is related to an issue we encountered when working on Crysis DX10 and WDDM 1.0 which led to a Microsoft releasing a QFE patch - video memory was being virtually mapped in the process virtual space leading to the process running out of virtual memory. Since 64bit memory space is more than sufficient, the memory optimization may not be applied on 64bit processes. This is a guess however.

In conclusion you don’t need to worry about this.

---

<div class="post-metadata">

**Author:** ![rNdm74](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/rndm74/32/43_2.png) [@rNdm74](https://discourse.glfw.org/u/rNdm74)\
**Post date:** [July 2, 2016, 9:59am UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/5 "2016-07-02T09:59:49Z")

</div>

Hi Doug,

Thanks for that explanation, however I am looking for a concrete answer, instead of conjecture and speculation.

Thank you for your time and analysis.

Kind regards,

Adam

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [July 2, 2016, 10:51am UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/6 "2016-07-02T10:51:46Z")

</div>

Hi Adam,

The best way for a more concrete answer than that provided is to investigate this yourself. I’ve linked to some of the tools with which you can do this. There are further tools available such as [ETW tracing and GPUView](https://randomascii.wordpress.com/2015/09/24/etw-central/), [VMMap](https://technet.microsoft.com/en-us/sysinternals/vmmap.aspx) and [RAMMap](https://technet.microsoft.com/en-us/sysinternals/rammap.aspx).

Good luck.

Cheers,

Doug.

---

<div class="post-metadata">

**Author:** ![rNdm74](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/rndm74/32/43_2.png) [@rNdm74](https://discourse.glfw.org/u/rNdm74)\
**Post date:** [July 2, 2016, 9:26pm UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/7 "2016-07-02T21:26:28Z")

</div>

Thanks,

However comparing against an SDL2 window (same scenario as above), there is no memory leak appearing on the resizing of the window.

This would suggest that there may in fact be a problem within the GLFW framework (hard to believe).

I suggest this should be looked into.

If I may be directed to a maintainer that would deal with such an issue, it would be greatly appreciated.

Kind regards,

Adam

---

<div class="post-metadata">

**Author:** ![elmindreda](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/elmindreda/32/26_2.png) [@elmindreda](https://discourse.glfw.org/u/elmindreda)\
**Post date:** [July 2, 2016, 10:21pm UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/8 "2016-07-02T22:21:54Z")

</div>

Did the SDL window have an OpenGL context?

---

<div class="post-metadata">

**Author:** ![rNdm74](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/rndm74/32/43_2.png) [@rNdm74](https://discourse.glfw.org/u/rNdm74)\
**Post date:** [July 2, 2016, 10:57pm UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/9 "2016-07-02T22:57:32Z")

</div>

Yes,

As I said above, exact same context as above test, however implementing SDL 2 to create the window etc.

What .h / .c files pertain to handling the resize of a GLFW window, if I may have a look at them.

Kind regards,

Adam

---

<div class="post-metadata">

**Author:** ![elmindreda](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/elmindreda/32/26_2.png) [@elmindreda](https://discourse.glfw.org/u/elmindreda)\
**Post date:** [July 2, 2016, 11:17pm UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/10 "2016-07-02T23:17:03Z")

</div>

So first of all, please stop being rudely dismissive of advice you asked for. You wanted to speak to a maintainer? Hello. Listen to what @dougbinks said. That is by far the most likely cause.

Your test code is a broken link to an image. Please post the actual code instead, and the corresponding SDL code.

Win32 window handling is in the `win32_window.c` file.

> <https://github.com/glfw/glfw/blob/3.2/src/win32_window.c>

---

<div class="post-metadata">

**Author:** ![rNdm74](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/rndm74/32/43_2.png) [@rNdm74](https://discourse.glfw.org/u/rNdm74)\
**Post date:** [July 2, 2016, 11:47pm UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/11 "2016-07-02T23:47:52Z")

</div>

Thanks for the reply,

Unfortunately, useless dribble is not worth my time.

However, you should look into your memory leak issue, as it **IS** very poor form.

Kind regards,

Adam

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [July 3, 2016, 1:14am UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/12 "2016-07-03T01:14:11Z")

</div>

Hi Adam,

There is no memory leak from GLFW as per my earlier reply.

Cheers,

Doug

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [July 3, 2016, 8:34am UTC](https://discourse.glfw.org/t/maximising-window-on-x64-build/694/13 "2016-07-03T08:34:45Z")

</div>

I’ve blocked user rNdm74 for being rude once again after having been warned.
