Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » U++ Allocator & Vulkan
Re: U++ Allocator & Vulkan [message #57463 is a reply to message #57461] Sun, 22 August 2021 09:37 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14260
Registered: November 2005
Ultimate Member
Xemuth wrote on Sat, 21 August 2021 17:47
I installed my Vulkan work on my Debian desktop and tried to compile the most basic code :

//#include <Core/Core.h>
#include <iostream>
#include <vulkan/vulkan.h>

int main(int argc, const char *argv[])
//CONSOLE_APP_MAIN
{
	VkInstance instance;
	VkApplicationInfo appInfo{};
    appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
    appInfo.pApplicationName = "Hello Triangle";
    appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
    appInfo.pEngineName = "No Engine";
    appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
    appInfo.apiVersion = VK_API_VERSION_1_0;

    VkInstanceCreateInfo createInfo{};
    createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
    createInfo.pApplicationInfo = &appInfo;
    createInfo.enabledExtensionCount = 0;
    createInfo.ppEnabledExtensionNames = nullptr;
    createInfo.enabledLayerCount = 0;

    if (vkCreateInstance(&createInfo, nullptr, &instance) != VK_SUCCESS) {
        #ifndef CORE_H
			std::cout << "Error\n";
        #else
			Upp::Cout() << "Error\n";
        #endif
    }else{
		vkDestroyInstance(instance, nullptr);
    }
}


A simple vulkan instance creation using default allocator. Here is my probblem:

If I include Core in my project without using USEMALLOC flag. This simple code result in memory leak :
https://i.imgur.com/7e7x4Gc.png
with USEMALLOC (or removing Core package) no problem happen.

From my knowledge, Vulkan, in order to work properly must have allocator that's aligned on 4 octet. May it's the reason of this error ?


U++ allocator aligns to 16 bytes. More likely Vulkan is calling new/delete and it is "system" new/delete - there is no solution to the problem AFAIK. Same issue we encountered on macos; partial solution is to use U++ allocator where U++ is using it directly (which is still plentiful) and use standard new/delete elsewhere. I think it is flagSTDNEWDELETE - check PLATFORM_MACOS.
 
Read Message
Read Message
Read Message
Previous Topic: set up ide minimize option when Execute (Ctrl + F5)
Next Topic: Refining IsNull(double)
Goto Forum:
  


Current Time: Sun Jun 01 10:48:49 CEST 2025

Total time taken to generate the page: 0.02314 seconds