Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 730 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 5 1 2 3 4 5
Re: Trouble with Published Game ... Again [Re: Dooley] #451925
05/26/15 15:11
05/26/15 15:11
Joined: Nov 2011
Posts: 274
de
lemming Offline
Member
lemming  Offline
Member

Joined: Nov 2011
Posts: 274
de
Originally Posted By: Dooley
From Gamestudio website:

Quote:
(...) memory and pointer handling, is automatically managed in lite-C. No crashes, memory leaks, and pointer arithmetics anymore!






To stay on topic: I'm afraid there is no easy solution to find memory leaks in liteC. If you have problematic functions you don't understand, try to rewrite them from scratch to get a better understanding. This will improve your skills AND your code in most cases.

Last edited by lemming; 05/26/15 15:20.
Re: Trouble with Published Game ... Again [Re: Dooley] #451926
05/26/15 16:19
05/26/15 16:19
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Originally Posted By: Dooley
Is this true? Maybe upgrading to A8 will solve my problem?

No and no. A8 will not fix faulty code or even damaged files which can lead to crashes too, how would it.

Memory leaks and other related crashes can be caused from of course not freeing allocated memory (i.e. you have to use sys_malloc or malloc in your code for that to happen) or overwriting stuff, for example
for(i = 0; i <= 10; i++) my_array[i] = i;
where
var my_array[10];
does not have a 10th entry. As a result you overwrite the 4 byte that follows the my_array array in your memory and all kind of weird stuff can and usually will happen.

The problem may lie somewhere completely else though too and that is a faulty file which happens more often than one would imagine. Over the years I've experienced that a few times already, and oftentimes I have to strip down my projects completely (make a backup first/ work with a backup copy) which can take a week or two. Preferably, you want to be able to delete as much as possible with the bug still intact so you can try and find its cause. Otherwise, if you only delete or change (as in your case) a little and the bug disappears it's likely you just have postponed the error to reappear at some random point in the future.
I've once had random crashes in a multiplayer skateboarding game with multiple levels, I've checked everything, my whole code over and over, stripped down the whole project only to find (with the help of jcl) that one texture in one of the levels was damaged. Then on loading erroneous stuff would happen and overwrite random areas which would lead to subsequent code crashes.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Trouble with Published Game ... Again [Re: Superku] #451927
05/26/15 17:48
05/26/15 17:48
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
I have had my share of little memory mistakes too , and also particularly one that caused any change to function names or code to make the application seem to function or suddenly break .

my cause was a structure that was allocated and then freed while on the very next line I was attempting to use it however the pointer wasn't really set empty though .

secondly make sure that you always check any pointer you plan to use , like :

if (entity!=null)
{
its safe to use
printf ("good in function foo line 12");
}
else
{
its unsafe to use
printf ("bad in function foo line 134");
}

then also , never ever run SED in compatibility mode , I had applications run without a single problem from sed in compatibility modes , only to discover memmory issues on release or shared with others wich .

lastly just a mention of something that came up not so long ago, there is apparently a mention by jcl that certain entity data is still accessible as non empty pointers until they are flushed after a certain process , it was recommended to check entity type along with entity! =null to be really sure .

no matter how gamestudio try to make memmory handling easier , in the end lite-c is still an unmanaged language so you still have to be fully aware of using memmory /pointers etc correctly.


Compulsive compiler
Re: Trouble with Published Game ... Again [Re: Wjbender] #451937
05/27/15 11:14
05/27/15 11:14
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Checking for entity = null wont work because the engine doesnt null the pointer when it has been removed. Most annoying thing ever. Had to hook ent_remove and do it myself..

Re: Trouble with Published Game ... Again [Re: Ch40zzC0d3r] #451940
05/27/15 13:11
05/27/15 13:11
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
quoted myself:

" lastly just a mention of something that came up not so long ago, there is apparently a mention by jcl that
certain entity data is still accessible as non empty pointers until they are flushed after a certain process , it
was recommended to check entity type along with entity! =null to be really sure ."

^


Compulsive compiler
Re: Trouble with Published Game ... Again [Re: Wjbender] #451949
05/28/15 05:08
05/28/15 05:08
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
Thanks for all the help. I will be looking into all these ideas.

One question: Are entities automatically released on a level change?

Re: Trouble with Published Game ... Again [Re: Dooley] #451952
05/28/15 05:32
05/28/15 05:32
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Memory which got allocated by the engine itself (let's say via WED entities or ent_created entities) does get freed automatically.

However, when you do more fancy stuff such as

my.skill90 = txt_create(...);
my.skill91 = allocate_pathfinding_data(...);

abd so on, you will need to release the memory manually, even on level change. Check out the on_ent_remove event.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Trouble with Published Game ... Again [Re: Dooley] #451953
05/28/15 05:47
05/28/15 05:47
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
For Superku:
How would you determine whether a texture is damaged? I assume that opening it in photoshop would work, but if there's a better(read faster) way, that would be great!

Re: Trouble with Published Game ... Again [Re: Dooley] #451955
05/28/15 06:45
05/28/15 06:45
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Sadly I'm not aware of any.
That's where the "create copy, strip down project" approach comes into play.

If you use skycubes, try removing them first.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Trouble with Published Game ... Again [Re: Superku] #451957
05/28/15 07:00
05/28/15 07:00
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
I had a problem where one of my models would cause a crash. Removing the model solved the problem, but the model opened in MED just fine, and it did not cause a crash when running the game through WED. So could this be a symptom of another problem, like memory leak, or some other corrupted file?

Do the damaged textures work in WED? Or is what you're describing only a problem in the published version?

Page 3 of 5 1 2 3 4 5

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1