About Store Forum Documentation Contact



Post Reply 
Background loading sometime causes crash
Author Message
tipforeveryone Offline
Bronze Supporter

Post: #1
Background loading sometime causes crash
I use a background loading technique for my game, following tutorial.

However, I've encountered a problem. When using background loading, there's a chance of memory corruption, which can cause unexpected crashes that are difficult to track down. https://i.gyazo.com/ab05865d7a58d085687a...65266.png, the mag (pointer) is not null, but some values of its class are unabled to read, mag is created inside background loading process

I suspect the issue arises because the thread handling the background loading is terminated before it completes its task. Even though I use a boolean flag at the end of the loading code to ensure all operations are executed, the problem persists.

My background loading process includes dynamically generated objects (such as characters and props) in addition to pre-placed objects created using the editor. Most of the time, background loading works fine, but occasionally it crashes.

Disabling background loading and using normal loading (which lacks a loading progress bar and temporarily freezes the game) eliminates the crashes.

Is there an effective method to ensure all background loading tasks are completed?
(This post was last modified: 05-25-2024 06:12 PM by tipforeveryone.)
05-25-2024 05:45 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: Background loading sometime causes crash
Hi,
There must be some bad logic in your codes.
Please recheck everything step by step.
Use critical sections (SyncLock) when needed, and/or operate on temporary data, that can be swapped to the global data under lock.
Just general ideas.
05-26-2024 06:19 AM
Find all posts by this user Quote this message in a reply
Post Reply