Need a little tool to adjust the Vram size

Thank you for this example, however it doesn’t work.
Whenever a game needs more vRAM than is available, the memory used by gpumem gets cleared and it won’t return an error. I’ve checked getLastError before freeing the memory and after, but it returns no errors as if nothing happened.

Can the clearing of memory be prevented? Does it get cached somewhere else or what’s going on here?