Comments (7)
Not only SDL but there are GL calls here and there in the demo program.
If you closely see, the demo program first initializes SDL which allocates some space on the heap. Then moving on there's SDL_CreateWindow(...)
, SDL_GL_CreateContext(...)
, and some GL functions which individually allocates several amount of space. and they never get free'd by the program itself. Although the kernel will free the space automatically, there can be a situation where allocated space may swap out.
I'm unsure about Windows internals and the meaning of private bytes. If it means dynamic memory, ProcessHacker perhaps also reports leaked memory that the demo program creates.
I've patched the memory leak issues with SDL, and one other. It does satisfy sanitizer but valgrind still complains about memory leaks. Currently don't have enough time, but a deep look will reveal it. Here's the patch file: https://pastebin.com/SWUMNJ6q
from microui.
Microui uses about 264~kb, checked it.
from microui.
Is 'lite' setting up a different kind of GL context with less memory footprint?
from microui.
No, OpenGL isn't a user level software. The memory usage is from SDL.
If you take a look in example, particularly here, you can see that in the demo SDL is initializing all its subsystem, which individually allocates memory. For example, the demo only needs video and a few basic contexts from SDL but it's initializing other contexts too, (e.g. an audio context).
See: https://github.com/libsdl-org/SDL/blob/efaa58732abb3faf3900b2d93a166b955fbd8ed0/include/SDL.h#L82
Even if you only initialize the video subsystem, I don't think memory footprint will be under some KiB.
from microui.
Hi again,
So, I have tried today to reduce the SDL subsystems to match with the "lite" that I am comparing with.
I just got a reduction from 30 to 29 Mb of RAM usage.
https://github.com/rxi/lite/blob/38bd9b3326c02e43f244623f97a622b11f074415/src/main.c#L71
//SDL_Init(SDL_INIT_EVERYTHING);
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
Then I thought that probably lite is not using opengl at all, but actually SDL with gdi.
But this test will take some more time, since the microui example is using all GL calls.
//window = SDL_CreateWindow( NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL);
window = SDL_CreateWindow( NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_HIDDEN);
Is there any working example on how to use microui with GDI for normal desktop applications ?
from microui.
I'm not sure about it. Lite seems to only uses SDL for handling every graphics context and SDL under the hood uses OpenGL and GDI (Graphics Device Interface on Windows).
I don't think GDI is the main reason of being "lightweight" on memory. GDI is a legacy component in Windows, mainly used for 2D graphics. But again, I'm not sure how process hacker counts "Private Bytes" in this context.
What's the memory usage in task manager of that application? Is that exactly same as "Private Bytes"?
from microui.
yes, gdi is legacy, but legacy-support also means high-portability, and that its associated libraries are preloaded by the OS.
However, I have the un-expert theory that opengl interaction with graphics cards requires more buffering of textures, context and scenes, that are not required with GDI. So far, I have seen almost all smallest possible apps with opengl to take 28Mb of Ram as a bare start.
I wonder if one could use microui with the bare canvas drawings of a gdi, direct2d or whatever, or is it just fixed to ogl?
from microui.
Related Issues (20)
- How can you resize microui window dynamically? HOT 2
- demo/build.sh is not suitable for MacOS HOT 1
- Post a screenshot HOT 7
- Licensing HOT 1
- DirectX 9 HOT 3
- Porting push_quad to DirectX
- Can I use it without SDL ? HOT 1
- Hash function "Cannot convert from 'const void *' to 'const unsigned char *'" HOT 4
- Question: how do I open a window HOT 2
- Library dependency HOT 1
- Why is black area covering gui appearing after resizing window? HOT 1
- Trying to get a window container within another window HOT 3
- C string gets corrupted when passed to the TextCommand handler HOT 3
- How to port to another low level access graphic control HOT 4
- Textbox improvements! HOT 3
- Question: Microui extensions
- Question: Running demo on windows HOT 2
- Can you layout from minimum required sizes by child widgets?
- 'step' does not work with mu_slider_ex HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microui.