jpbruyere / vke.net

Vulkan .net library
MIT License
13 stars 3 forks source link

Memory leak in Windows #3

Open bbvrpz10k opened 4 years ago

bbvrpz10k commented 4 years ago

When MEMORY_POOLS is true RAM is reserved by the straps and the program stops erorr System.InvalidOperationException: 'Call failed: ErrorOutOfDeviceMemory' in

  Name Value Type
  StackTrace " at Vulkan.Utils.CheckResult(VkResult result, String errorString) in F:\Project\vke.net-master\vke\src\Utils.cs:line 18\r\n at vke.MemoryPool..ctor(Device dev, UInt32 memoryTypeIndex, UInt64 size) in F:\Project\vke.net-master\vke\src\MemoryPool.cs:line 49\r\n at vke.ResourceManager..ctor(Device dev, UInt64 defaultPoolsBlockDivisor) in F:\Project\vke.net-master\vke\src\ResourceManager.cs:line 30\r\n at vke.Device.Activate(VkPhysicalDeviceFeatures enabledFeatures, String[] extensions) in F:\Project\vke.net-master\vke\src\base\Device.cs:line 97\r\n at vke.VkWindow.initVulkan() in F:\Project\vke.net-master\vke\src\VkWindow.cs:line 163\r\n at Textured.Program.initVulkan() in F:\Project\vke.net-master\samples\Textured\main.cs:line 69\r\n at vke.VkWindow.Run() in F:\Project\vke.net-master\vke\src\VkWindow.cs:line 329\r\n at Textured.Program.Main(String[] args) in F:\Project\vke.net-master\samples\Textured\main.cs:line 18" string
jpbruyere commented 4 years ago

Sorry, I've just seen your Issue now. For now, one memory pool per type is created with a global divisor on the total. Now that I've tested dynamic allocations on fixed memory size, I should provide a smarter pool constructor, that expand size when needed. To achieve that, I have to clearly identify what have to be reinitialized after memory moves. Also vulkan introduce movable memories (I've not yet tested that). I'll come back to you when I'll have time to work on this, don't hesitate to propose pull requests to improve mem pools. the interesting code with the divisor is here