Questions tagged [memory-efficiency]
A way of organizing and storing information so that it occupies as small an amount of memory as possible while still retaining its full usefulness.
159 questions
1
vote
0
answers
50
views
Reserved Memory Keep Increasing When Loading the Same GameObject Using Unity Addressables
I'm trying to learn how to use Addressables in Unity to improve memory usage, but there's something I don't understand.
I use ...
0
votes
1
answer
148
views
How to efficiently construct model matrices in a vertex shader from a small amount of data, for instanced rendering of many moving 3d game characters
I am trying to efficiently render many 3d game characters: many instances of the same 3d model which can change their positions and z rotations each frame. For reference I'm using OpenGL but this ...
0
votes
0
answers
118
views
Unable to determine cause of memory leak in Unity when using Addressables. Can anyone give suggestions on what the cause might be?
I'm creating a simple bullet hell game for Android and I ran into an issue when diagnosing my game using the Memory Profiler where memory usage was increasing after each play-through. I had calls to ...
1
vote
1
answer
263
views
I am testing the flyweight pattern on thousands of GameObjects but its not helping save memory. What am I doing wrong here?
I am trying to understand the flyweight pattern better by trying to optimize memory usage by spawning 10000 copies of an enemy GameObject that I have which has an Animator component, SpriteRenderer ...
2
votes
1
answer
338
views
Padding in a vec3f array in WebGPU memory layout
I'm trying to write a WGSL structs parser (sort of webgpu-utils thing). In order to better understand the memory layout, I'm using wgsl offset computer as a helper.
Having the next struct:
...
4
votes
2
answers
3k
views
How does Godot 4 copy vectors?
I'm an old coder, but a newbie to Godot. I'm using version 4.
I got some unexpected (to me) behavior when I tried this code:
...
0
votes
1
answer
939
views
what is more memory intensive in Unity: 100 GameObjects with PaticleSystems, or 100 GameObjects spawning other GOs
I am making a bullet hell game. Say there are 100 bullets on the screen, and each bullet has a trail effect. Is it more performant to give each GameObject a ParticleSystem, or for each GameObject, ...
1
vote
1
answer
9k
views
Issue with Texture2D memory leak in Unity
I have a simple method that converts RenderTexture data into Texture2D
...
2
votes
1
answer
856
views
OpenGL: What to do after running glBufferData?
I am interested in understanding a bit more behind how OpenGL does its memory management and what are some good practices before I start heavily coding and back myself into a corner.
The real question ...
-1
votes
2
answers
114
views
How to load 3D modells when they are necessary
I'm working on a 3D game engine, currently I load ALL of my 3D modells into the memory when my game starts, but obviusly there will be hundreds of 3D modells, so somehow I should unload them when they ...
4
votes
1
answer
6k
views
Game Engine Memory Allocator
I'm a bit confused on how to implement an allocator for my game engine. I'm currently trying to implement PhysX for the physics in my game and it requires an implementation of an abstract allocator ...
6
votes
1
answer
1k
views
How do open world game engines allocate memory?
My troubles
I've been trying to create a game engine but since I am not well experienced in C++ I am having trouble deciding on how to load new scenes efficiently level by level or just an open world.
...
8
votes
1
answer
2k
views
Use floats or doubles when writing mobile games
I know for shaders, floats should be used because they are the optimal choice for performance. Doubles are slow and use more memory which isn't ideal for shaders. While floats are less accurate and ...
1
vote
0
answers
337
views
How to render decoded video that is on GPU memory without copying to CPU
I'm reading this example of ffmpeg hardware decoding: https://github.com/FFmpeg/FFmpeg/blob/release/4.2/doc/examples/hw_decode.c
At line 109 it does this:
...
1
vote
2
answers
1k
views
Unreasonably large memory use with high-res screenshot script
I'm using this piece of code to save renders and I'm saving renders in every frame inside Update().
Code:
...
1
vote
0
answers
98
views
No-duplicate collection without iterator allocation [closed]
Problem
I need a collection with non-duplicate values minimising memory allocation during access operations. I am prepared to compromise with a slight decrease of performance to make up for the ...
1
vote
1
answer
2k
views
Avoiding GC Allocation in Unity UNet API
I'm trying to profile the game using Unity Profiler, I can see in the Hierarchy tab that there's an 18.3 KB correlated to ...
3
votes
1
answer
3k
views
Unity3d - Do I need to destroy gameobject AND script?
From proper leak protection do I need to delete both of these or will getting rid of one take care of both?
Currently I am destroying the script AND the gameobject
...
1
vote
1
answer
629
views
Avoiding Out-Of-Ram Crashes in unity [closed]
My Players experience crashes on older computers when they enter a scene with a lots of 3d models.
Is there anything I can do to avoid this, except deleting those models from the scene?
1
vote
1
answer
3k
views
Memory is not getting freed on Destroy()
Manager script(simple script attached to an empty GameObject on scene) on Start() instantiates 1000 default cubes with rigidbody component added and gravity check ticked.
...
3
votes
0
answers
221
views
MeshMemory causing constant spikes
I have a ready-to-launch application, cleaning everything right now. I have these strange spikes on Mesh Memory.
The best part of it is that this view below is ...
1
vote
1
answer
1k
views
How can I make a custom memory allocation for classes with virtual methods? [closed]
I want to create a custom allocator that stores objects to the heap sequentially. The allocator itself is very simple. It just allocates a big chunk of memory and moves an offset as ...
30
votes
2
answers
6k
views
Is A* efficient even when the obstacles are moving?
I'm just starting to learn about path-finding and have been looking into the A* algorithm and my main concern is that it all of the examples I have seen show static obstacles that it computes around.
...
24
votes
1
answer
6k
views
Why should I always consider creating and using object pools instead of instantiating the new object on the fly?
I have read about this pattern several times (from a best-practices perspective):
Memory Allocation: Instead of instantiating the new object on the fly, always consider creating and using object ...
0
votes
1
answer
536
views
What is more efficient in Unity recorded animation or Slerp/Lerp?
What is more efficient in Unity recorded animation or Slerp/Lerp? What will be faster?
It is obvious that the animation will take a lot more space.