Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Baklazhan, Ayumi, Hanky27), 1,348 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Dynamic variables/structs/entintys/etc names [Re: EvilSOB] #241250
12/15/08 02:45
12/15/08 02:45
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
I have been reading about the malloc() and free() instructions and I am kind of worried of "forgetting" to free() memory I have reserved. It sounds very easy to create programs with memory leaks when you start using those instructions!

I have a couple of questions:

If I forget to free() memory allocated with malloc()...
When the engine shuts down will all that reserved memory that still has not been released with "free()" stay "blocked" forever untill I turn off my computer?
Or when the program is closed, will the engine automatically "free()" all the memory that was still reserved because I forgot to release it?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Dynamic variables/structs/entintys/etc names [Re: Carlos3DGS] #244453
01/04/09 19:57
01/04/09 19:57
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Anyone know?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Dynamic variables/structs/entintys/etc names [Re: Carlos3DGS] #244454
01/04/09 19:58
01/04/09 19:58
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Does anyone know a good beginner's tutorial forlinked lists?
And also a more advanced one for when I finish learning a basic one?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Dynamic variables/structs/entintys/etc names [Re: Carlos3DGS] #244460
01/04/09 20:33
01/04/09 20:33
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I cant help with linked lists, but apparently any memory you malloc
WILL be cleanly "free'd" with the acknex engine closes.

The biggest fear I find is free'ing a block thats already free,
as this causes intermittant crashes, so I wrote this malloc
replacement code. Hope it helps...
Malloc replacement contribution


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Dynamic variables/structs/entintys/etc names [Re: Carlos3DGS] #244484
01/05/09 00:12
01/05/09 00:12
Joined: Jul 2002
Posts: 446
Switzerland
Mr Wurm Offline
Senior Member
Mr Wurm  Offline
Senior Member

Joined: Jul 2002
Posts: 446
Switzerland
Theres a lovely tut on precisely what you're searching for in the tut section of acknex.

linked lists

Have been playing with malloc myself lately, fun stuff, haven't managed to crash my 'puter with it yet though...but i'm trying smile


- Mr Wurm

Re: Dynamic variables/structs/entintys/etc names [Re: Carlos3DGS] #244514
01/05/09 08:29
01/05/09 08:29
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Maybe you should take a look at my GSHashmap ...

In many cases it can replace "linked lists" and it can be handled much easier.

I use it in my click&point adventure to handle all useable objects (some hundreds) and save their properties over the whole game.

One of many advantages:

You don't need to do something like this:
Code:
ENTITY* soldier1;
ENTITY* soldier2;
ENTITY* soldier3;
etc...
ENTITY* soldier100;

You just need one:
Code:
ENTITY* soldier;

You can use this pointer x-times for all your soldiers and store each of them under a unique key in the hashmap. This key can be generated automatically for example in a for-loop just by converting the counter to a string and use this number as key. With those keys you can access your soldiers anytime you want.

Best advantage you from the GSHashmap if you use structs ... with the hashmap you can link entities with structs in a very easy way and you can still access the hashmap even if you change the level.

Regards,
Pegamode.

Re: Dynamic variables/structs/entintys/etc names [Re: Carlos3DGS] #245674
01/11/09 09:23
01/11/09 09:23
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
Thanks everyone for your help. I will take a look closely at each approach before choosing one, but at a first glance they all look great!

Thanks!


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Page 2 of 2 1 2

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