Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
2answers
94 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: ...
0
votes
0answers
26 views

How to find the source of a memory leak in a Blockchain + Node.js game

We have been working in a Node.js game, part of a game network, which seems to be working slower and slower as you keep it open, as well as it seems to increase the RAM and CPU usage over time. We ...
1
vote
0answers
35 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 ...
0
votes
2answers
66 views

Any advantage of having chunks with sizes by the power of two?

With my past experience of having my little game lag because of the size of the world, I have decided that in whatever next project I might choose to create, I will split said world into chunks. Now ...
1
vote
1answer
100 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 ...
1
vote
1answer
227 views

Unity - SpriteAtlas memory consumption

I'm in the process of optimizing my application memory consumption. To do so, I'm using Unity profiler while connecting to an Android device, which runs a development build of the application. The ...
3
votes
1answer
1k 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
2answers
117 views

How can I store my 2D map in JAVA?

I'm working on a 2d adventure game where the player can explore a random generated map. It's working perfectly if I set it to be about 3000x1000 blocks (my array is 3000x1000x2), but this is TOO SMALL....
1
vote
1answer
54 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?
0
votes
1answer
211 views

How do open world games handle efficiently enemy respawn?

I'm currently working on a 2D open world game loaded in chunks, initially I thought It would be sufficient to spawn entities randomly in a specific "radius" close to the player, and periodically ...
1
vote
1answer
422 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. ...
1
vote
0answers
33 views

string[] preallocation to prevent using ToString() and save memory

I have some levels, with enemy waves and two Text components for: Enemies killed, like: "13/57" Waves passed, like: "68" On each enemy kill/new wave, I make a <...
2
votes
0answers
123 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
votes
1answer
46 views

Static variable pre-declaration & memory heap expansion in Unity

When I profile my apps, I make sure that the code like this one: private void Update(){ int count = GetEnemyCount(); } get's converted to this one: ...
1
vote
1answer
308 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 ...
3
votes
2answers
192 views

Is single/double frame allocator suitable only for POD datas?

Let´s say I have a single frame stack allocator, so I´m using it for allocating memories for my temporary data. ...
30
votes
2answers
3k 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. ...
0
votes
1answer
1k views

Unity mobile game generates too much cache

I have built a game I have been working on for Android (Unity). It's a simple game: air hockey. It weights 21mb with all the assets and scripts. After playing for a bit I have noticed that cache of ...
25
votes
1answer
4k 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
1answer
252 views

DirectX11 bind all textures at once?

If my game will use say 100mb of raw memory for textures, would it be a good idea to put all of them in srv array, bind once and leave it for the rest of the program so that I won't have to bind them ...
0
votes
1answer
102 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.
1
vote
0answers
58 views

When should I use auto-managed buffers in LWJGL 3?

LWJGL3 has two methods of creating buffers that I know of: Auto-managed buffers that clean up the buffers automatically using the MemoryStack class, and manually managed buffers that must be manually ...
2
votes
1answer
317 views

Should I avoid constructors/destructors in C++ when using custom allocators?

I'm currently building my first 2D game engine and have reached a point where some large-scale tests have shown that some form of custom memory management would be beneficial (object pools). So I ...
0
votes
1answer
264 views

Efficient Dynamic Memory Management

My world is procedurally generated. As the player moves, chunks behind them are unloaded and chunks in front of them are loaded. Each chunk has a mesh of triangles. At the moment, I create two VBOs ...
2
votes
1answer
443 views

How can I build a data structure that will persist across saves/loads in GameMaker version 8.1 and earlier?

I wish to build data structures such as trees, linked lists, graphs, stacks, queues, etc. in Game Maker. However, the concept of object in Game Maker Version 8.1 and older does not have a reliable ...
0
votes
0answers
143 views

Unity - change sprites to something that uses less memory

I have a game that uses only silhuette textures, but they take up waay too much memory (360 MB overall and this is a mobile game) so I plan to avoid using sprites with ...
1
vote
0answers
69 views

Memory usage increasing ~10kb every frame [closed]

I am currently developing a game for Android (using the SDK) and have been trying to reduce the memory usage. I have discovered that during each frame, the memory usage increases by about 10kb. The ...
0
votes
1answer
112 views

Best way to add and remove quads in a VBO?

What's the best way to handle adding and removing 2D sprites (quads) in a VBO? I am working on a mobile board game and sometimes game pieces (represented by quads graphically) need to be added to or ...
8
votes
1answer
5k views

Difference in glDrawArrays and glDrawElements

While refreshing my mind on OpenGL ES, I came across glDrawArrays and glDrawElements. I understand how they are used and sort ...
0
votes
1answer
59 views

Is reusing BitmapFonts possible in GDX?

I'm loading multiple labels (100+) with different font types (max 10), but they have different sizes. As I read the code and did the research, it's not possible to 'reuse' the font. For instance, I ...
2
votes
1answer
610 views

Libgdx game crashes on some devices without any Errors / Logs

I'm making a similar game to the talking tom game where a character is animated on the screen and talks back. I have about 100 transparent PNGs for each animation. There are 10 Animations. Each PNG ...
-2
votes
3answers
202 views

How should I store a large number of rooms with objects in them?

Right now I'm using C# in XNA/MonoGame. I'm brainstorming an isometric game that consists of rectangular rooms. The allowed dimensions of each room range from 3x3x3 to 12x12x6. The max volume of each ...
1
vote
1answer
389 views

Game data structure in node.js

I am building a simple turn-based game in node.js using sockets.io. My web experience with node.js has typically involved saving everything to a relational database. I set this up for my game. I am ...
0
votes
0answers
83 views

Unity 2d: Not Destroying enemies - impact on memory

I know pretty much zero about game performance in Unity. I am trying to figure out if I can afford to put this feature in my game: I would like to have the enemies killed to pile up in a sort of heap,...
1
vote
1answer
281 views

One large tileset or multiple tilesets

I'm currently writing a 2d tile scroller for a hobby project and I can't find any resources to give me a clear answer to which is more efficient to do. Each block contains tiles 44 by 24, 32px x ...
2
votes
0answers
514 views

Keeping a mesh entirely at the GPU and changing its vertices there with a ComputeShader (Unity5)

In a Unity game I have an object whose mesh is made of around 10k vertices and I have to make changes to these vertices (position, color, etc) almost every frame. Considering that such object is ...
0
votes
1answer
658 views

CPU and RAM usage in OpenGL too high in Swift

My game is set up so the the display controls the game loop, usual in Cocoa. The callback function calls run() which is this. The thing is, the thread running the ...
0
votes
0answers
126 views

Storage and Lookup of Voxel Chunks

How can one store chunks in such a way that they can be looked up using their XYZ location without wasting memory? The problem with a HashMap<Vector3i, Chunk>...
17
votes
1answer
3k views

Any downsides to exporting an audio file at double-speed then have the game engine playback at half-speed?

I want to cut back on my game's file size and music and SFX are taking up a good chunk. If I make a song or sound effect at 120bpm and then apply a tempo and pitch doubling using a DAW or standalone ...
2
votes
1answer
128 views

Performance differences: one empty GameObject with multiple child objects vs. single GameObject formed by pre-merging the former child objects

Imagine a robot game where robots are made of pre-built blocks. Therefore, each block is a separate GameObject, with one mesh each. I am trying to understand the conceptual differences behind the ...
4
votes
1answer
557 views

Efficient vertex buffer memory management?

I am building a voxel engine with a similar mechanism to minecraft(yes, I know...). It works by loading and unloading individual chunks of 16*64*16 cubes each in a square grid around the player. This ...
4
votes
1answer
458 views

Libgdx: how does dispose() work?

My game uses a lot of images, for the over-world, battle screens, chats, etc. I'm really meticulous when it comes to memory management, and I've noticed that even though I dispose every image when I ...
0
votes
1answer
463 views

Libgdx crash on dispose()?

Whenever I try to manually call the dispose method in one of my screen my game just crashes. My dispose looks something like this ...
-2
votes
1answer
684 views

Libgdx incredibly high RAM usage! [closed]

Alright so I'm new to Libgdx and Game programming in general, and I've got a huge problem. If I leave my game on, it will start to eat memory, pretty fast at that, until it reaches a point my PC hasn'...
0
votes
1answer
214 views

Generating Formulas for glDrawElements with Tile Grids

glDrawElements can be used to save you from uploading a lot of vertices to the GPU. Many 2D games use tiles, which are rendered in grids. I have done some ...
1
vote
1answer
386 views

Method of handling audio and memory in game

I've started coding a new game project and I've implemented Ogre for the graphics rendering and begun thinking about the audio side of things. I was considering using the SFML audio component for ...
2
votes
1answer
1k views

Unity Profiler - What would cause PlayerEndOfFrame to have 10-16MB in GC Alloc?

I can't find much documentation on what "PlayerEndOfFrame" does. Sure it is the end of a frame but what would cause the GC Alloc to go so high? This is the profiler results from a debug build on a ...
2
votes
1answer
120 views

Java - Loading background music into memory

I am currently developing a game with Java, with a soundtrack consisting of ten tracks in .ogg format, 1-2 MB in size each. To be able to switch between these tracks quickly and easily in the game, ...
1
vote
2answers
287 views

How can I minimise memory thrashing when doing vector math in C# or C++?

I'm doing a lot of 3D math in my game engine loop using typical classes like Vector3D, Matrix4x4, Plane3D, etc. Currently every operation causes a new object to be created for the result value. The ...
7
votes
2answers
2k views

What is the most appropriate path-finding solution for a very large proceduraly generated environment?

I have been reading quite a bit in order to make the following choice: which path-finding solution should one implement in a game where the world proceduraly generated, of really large dimensions? ...