I got 4.5 Million MSDF glyphs showing on Mac M1, using Instancing, why initial memory usage is high, compared to the expected amount?

I just cloned the repo. Seems os2 is in it. I’m on the newest version of Odin. os2 is now merged into os. os2 renamed to os/old. Some of the procedures referencing os are failing to compile because of different return counts. I’ll try to work through it so I can run it and play around.

Project can run without fixing it, os2 is used in build.odin.


Which just does Shader compilation, unless you are on different os and need to compile to another target.


I pushed another commit with spv, dxil compiled shaders, so you can run it without fixing os2 stuff.

It’s here too

/FontRendering/src/asset_manager.odin(4:1) Syntax Error: Path does not exist: core:os/os2 

I’m on Linux.

Several of the procedures in os have changed. Some now require an allocator. Many that did not return an err now do, so return counts are off on many file procedures.

Got code errors fixed, now I seem to be missing imgui_linux_x64.a

I’m using latest Odin, release 2026-02, but errors don’t show up for me.

Are you on master?

I will get rid of Dear Imgui, once I have my own UI done using Clay.

Till then you can follow, Taskfile.yml, I have added some commands that might help:

init_imgui:
    summary:
      Go into shared directory of odin and then clone / put a zip of imgui in it.
      Then install deps like ply and build the project.
    cmds:
      - cd /opt/homebrew/opt/odin/libexec/shared
      - python3 -m venv venv
      - source venv/bin/activate
      - python3 -m pip install ply
      - python3 build.py

dev-2026-02-nightly:545d17fd8

When the switch happened for os2 to os, I found that I had to delete my old Odin folder and clone a clean download, otherwise old files no longer used and folders whose names changed are left in place and can make it difficult to detect what is referencing old and new.

Living dangerously I see.

That’s just the name given by the make scripts when compiling with “make nightly” on Odin. It’s still the same code base as what most see as release 2026-02 when the zip is downloaded instead of cloning directly from master.

I will check this, and fix it.

I’ve got to work on dependencies and other things in my environment before running FontRendering, and it’s getting late. I’ll play with it some more tomorrow.

I assume you found the leaks though?

1 Like

I didn’t find it, will give it a try later in the evening or tomorrow.

Also, I will get rid of all dependencies, so only odin run . will be necessary and everything else will be part of the code base.

I don’t like the current state of things in the codebase.

Updated tracker to allow disabling ANSI formatting. Also changed the PANIC bool to NOPANIC to be more consistent with the NOANSI config flag. Make sure to update this bit that is copied to top of main:

	when ODIN_DEBUG {
		//tracker.NOPANIC = true // uncomment or override with: -define:nopanic=true
		t := tracker.init_tracker()
		context.allocator = tracker.tracking_allocator(&t)
		defer tracker.print_and_destroy_tracker(&t)
	}

build override flags (defaults are false)

odin build . -define:nopanic=true
odin build . -define:noansi=true
// or both at once
odin build . -define:nopanic=true -define:noansi=true
1 Like

This is great, Sublime build log will look pretty, thank you.

I haven’t figured it out, but removing all the builder code, which does explicit concatenation.

I still got the leak:

if im.InputText("Text: ", cstring(&g.text_buf[0]), 4_500_000) {
  g.new_string = string(cstring(&g.text_buf[0]))
}

Its getting late, I’ll find an alternative to this tomorrow.

Tracking Allocator didn’t give me the stack trace, or maybe I don’t know how to get the trace back to exact location in my code.

I just checked lldb, leaks command. Don’t know how to use it.

Opened the app using Xcode, but the memory leak detector can’t attach to the program.


So I was thinking about using something cross platform with a GUI, and frame graph.


Do you use it @xuul ?

No, but odin-tracy looks interesting. I’ll be checking that out.

I still believe the tracker is telling what the problem is. If contect.allocator still has allocations that have not been unallocated when the program exits, then that is likely the case. Odin, as far as i know, does not allow an allocation to happen without an allocator attached to it.

My best guess at this point from what I’ve been able to see is maybe there is cross core version issues in the project. I notice that the git repository for FontRendering has an old core version in it which still includes os2 (plus several procedures are still using os2), but you’ve mentioned that you are using Odin release 2026-02. When I tried to run it with latest Odin and core, there were several os procedures that produced compiler errors because they now require an allocator that they did not previously. I found those because they did not have a default so I was forced to supply one. That got me thinking that there are likely others that also had an allocator parameter added , but have a default, so those did not pop for me and will possibly be harder to find.

I got everything all fixed up, but then could not compile due to the dependency issues. Plus some weird paths seemed to be referenced with double slashes, which I have not determined if it’s my environment or not causing it.

Update: In addition to that, I see many things are Mac related, most specifically metal, which is the gpu renderer for mac. I’m on Linux, and would need vulkan or opengl. If I can find some time to get it going for me, I can help add some “when” clauses to help support both platforms. I ran out of time this weekend messing with some other stuff.

1 Like

Thank you for taking your time to run the program.

I’m surprised it didn’t run on your system. I added other shader compilation targets so you can run it too, don’t know what other format I am missing.

Also, it’s okay, don’t waste your time on this.

You can just remove those dependencies, like Dear Imgui and the font renderer is solid.


I uninstalled and installed Odin, using homebrew and it has the OS2 package.

I’m not using nightly build, so the new change you are talking about, I don’t have that.


Also I passed some more allocators explicitly to wherever make is being used.
Disabled builder stuff, and still memory baloons.

Finally, I disabled Dear Imgui, aaaand no memory leaks, but balooning is there.

image


Just directly assigning 4 million characters to a global string makes the size 1.3 GB initially, before settling down to 467 mb.

Initial Memory usage: 414 mb (GPU), 1.3 gb(CPU)

Mid Memory usage: 414 mb (GPU), 467 mb (CPU)

Resting GPU usage: 28 (GPU), 77 (CPU)

And clearing the string, makes the memory go down to the app starting memory usage, which is good.

I am able to figure out, where memory is going now.


I have to get rid of Dear Imgui bindings and use Nuklear or Clay or something.

One example, is /src/main.odin. That is platform specific. Using different build targets are not going to change that unless it’s wrapped in a “when ODIN_OS { … }” clause where different gpu renderers are defined per platform. There’s other places in src where metal libs are referenced, but no alternatives define for other platforms.

g.gpu = sdl.CreateGPUDevice({.METALLIB, .MSL, .SPIRV, .DXIL}, true, nil); assert(g.gpu != nil)

There’s so many files and folders, I’m not sure what I can and can’t ignore. So maybe I’m trying to compile the wrong thing. I’m doing odin run ./src as per the git page.

Seems you are right. I just went and double checked the zip downloads. They are still including os2. So me cloning and compiling Odin has placed my core version ahead some.

Yes, that’s why you had to make a lot of change to make it compile.

I learnt the SDL GPU stuff from nadako on youtube:


He was on windows, and I was able to run the code he was using on Mac, so I thought it will run with minimal change.


I am waiting for Steam machine to release, so I can test my build and code on Linux.

As for windows, I don’t want to touch it.

Eventually I will make the game cross platform.


BTW, which dependencies are you having issue with?

Ok, now that I’ve realized my mistake with odin core versions, I’ve placed the latest release zip on my system and no more code issues. I’m just left with this to deal with

Updated again, and again:

/usr/bin/ld: /tmp/src-main-7c5a6ace6230.o: in function `main::load_font_msdf_file':
src-main:(.text+0x6ba0): undefined reference to `IMG_LoadGPUTexture'

This was introduced in latest SDL3 Image Vendor library upgrade.

See the changelog in Odin new release.
vendor:sdl3/image
Update to 3.4.0


Also I install SDL3, SDL3 Image using homebrew, so perhaps you have to install that as well, using linux package manager of choice.

  - brew install sdl3
  - brew install sdl3_image

Later I will figure out how to have everything in the codebase, not even rely on Homebrew, so that once the repo is cloned, the project can just run.