Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,513 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 5 1 2 3 4 5
Re: I need some outsider's perspective... [Re: Carlos3DGS] #416913
02/05/13 21:30
02/05/13 21:30
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
sys_nxalloc gets it's memory from the nexus while sys_malloc doesn't. But I wouldn't recommend sys_naxlloc anyways because you cannot free memory allocated this way. (Or has this been fixed in the meanwhile?)

sys_malloc and malloc should get the memory from the same source, i.e. the operating system. If the operating system refuses to give the engine more memory it will refuse to give you more memory as well. So it's not plausible that you'll get more memory when using malloc.

But I feel not completely safe talking about this. Maybe someone else can confirm my statements? Superku? JustSid?


Always learn from history, to be sure you make the same mistakes again...
Re: I need some outsider's perspective... [Re: Superku] #416915
02/05/13 21:31
02/05/13 21:31
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
So my assumption of having limited memory available would only be true for sys_nxalloc() but not for sys_malloc()? If so, for now I think I will switch back to using sys_malloc() and only discard using sys_nxalloc(). But it would be great if someone could confirm this


"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: I need some outsider's perspective... [Re: Carlos3DGS] #416918
02/05/13 21:36
02/05/13 21:36
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Well, even the nexus could be enlarged, but as I already said, the usage sys_nxalloc should be avoided anyways unless you really know what you're doing.

In fact there is always a limit on the amount of memory you can allocate. But I don't see a reason why the limit of allocated memory should be different for sys_malloc and malloc.


Always learn from history, to be sure you make the same mistakes again...
Re: I need some outsider's perspective... [Re: Uhrwerk] #416921
02/05/13 21:51
02/05/13 21:51
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
To my knowledge (that is mostly just based on using sys_malloc myself) those points all seem to be correct.
I assume sys_malloc just calls malloc and adds a few security and error handling "systems" (including the very useful sys_marker instruction that is not supported by the default malloc instruction).


"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: I need some outsider's perspective... [Re: Superku] #416939
02/06/13 07:32
02/06/13 07:32
Joined: Dec 2003
Posts: 1,225
germany
gri Offline
Serious User
gri  Offline
Serious User

Joined: Dec 2003
Posts: 1,225
germany
Originally Posted By: Superku
...
I assume sys_malloc just calls malloc and adds a few security and error handling "systems" (including the very useful sys_marker instruction that is not supported by the default malloc instruction).


Yes and because of that a direct malloc call is faster than sys_malloc.
But hey we are in C. If its not neccesary to build large arrays or objects at each engineframe I wouldnt care.

Ullllillia would create a benchmark for that and would us overheap with numbers.


"Make a great game or kill it early" (Bruce Shelley, Ensemble Studios)
Re: I need some outsider's perspective... [Re: gri] #416940
02/06/13 08:14
02/06/13 08:14
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
okay, I'm a bit sick to read all the posts but freeing of what I wrote earlier is:

Code:
int i;
	for (i=0;i<1000;i++)								// ###
		{
			sys_free( Bwater[i] );
		}
	sys_free(Bwater);
	Bwater	= NULL;


the last line is only needed if you plan to use again Bwater

the 100 in memset is an example value, I copied it from my existing code, where my default value is 100. I use similar arrays and srtuct arrays and array structs and arrayarraystructssctrucscscs grin extensively.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: I need some outsider's perspective... [Re: sivan] #416953
02/06/13 13:39
02/06/13 13:39
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
The last line is not required for a correct code but it's a very good habit to clear vagabonding pointers. This can save you from a lot of trouble.

Still the value 100 will be copied bytewise and hence works only for char arrays. The exception is 0, because four zero bytes are still the number 0 as an int. You can of course use any number that is a pattern cnosisting of four equal bytes.


Always learn from history, to be sure you make the same mistakes again...
Re: I need some outsider's perspective... [Re: Uhrwerk] #416975
02/06/13 18:04
02/06/13 18:04
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
hmm.. I used 100 only for chars until now, I copied it and modified to int, but good to know it has wrong result for int or other. thanks!


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: I need some outsider's perspective... [Re: Uhrwerk] #416994
02/07/13 00:02
02/07/13 00:02
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline OP
User
Carlos3DGS  Offline OP
User

Joined: Oct 2008
Posts: 513
I purpously closed the program withought freeing the memory allocated out of curiosity to take a look at what you guys said before about the log file. But I found nothing in acklog.txt stating any memory was not freed... Where can I find this information?

EDIT:
This is what my acklog.txt file looks like
Click to reveal..
Log of A8 Engine 8.20.1 run at Thu Feb 07 01:04:54 2013
KRLOS on Windows NT/2000/XP version 6.1 Build 7601
Options w_map_gen2.c -diag -nx 200 -t_ -debug
App: C:\Program Files (x86)\GStudio8\SED.exe in D:\SPHERE\WASTELAND\

MM mixer opened
DSOUND device opened
DI interface opened
Start Window opened(c) Conitec - www.3dgamestudio.com
A8 Engine - Commercial Edition V8.20.1 - May 12 2011
Development version
Registered to: Carlos Alberto Idrovo Carrillo

Mouse found
Altavoces (Dispositivo de High Definition Audio) opened
ATI Radeon HD 3300 Graphics pure T&L device 1ff9 detected
D3D device ATI Radeon HD 3300 Graphics 1ff9 selected.
acknet.dll opened
ackphysx.dll opened
ackwii.dll opened
Compiling W_MAP_GEN2.C - [Esc] to abort............. 0.346 sec
Running W_MAP_GEN2.C.
3 objects
Main started at 1.424 in debug mode
D3D_Init Window: 800x600 -> Window: 1x800x600x32
Video memory found: 2032 MB
LevelInit at 1.474 0 lmaps 0 textures...ok
LevelReady at 1.480
def_startup started
Main loop at 1.481....
1st frame with 2032 MB. at 1.522
Normal exit at 2.806
Close level,DLL,objects
Free input,funcs,panels,defs,syns,views,strings,vars..ok
Free sounds,bmaps,fonts,hash,defs1,script..ok
Close dx,multimedia,D3D,engine,nexus..ok
A8 Engine - Commercial Edition V8.20.1 - May 12 2011
(c) Conitec - www.3dgamestudio.com
Registered to: Carlos Alberto Idrovo Carrillo
Close window at 2.901

Last edited by Carlos3DGS; 02/07/13 00:10. Reason: added acklog.txt info

"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: I need some outsider's perspective... [Re: Carlos3DGS] #416995
02/07/13 00:18
02/07/13 00:18
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
No idea what you did wrong there. Here is an extremely simple example:
Code:
#include <acknex.h>

void main()
{
	sys_marker("WTF");
	void* p = sys_malloc(1337);
	sys_exit(NULL);
}


When you execute this snippet and have a look at the log file it says at the end:
Code:
[...]
Unfreed: 943, WTF, 1340 bytes
Close window at 1.217



Always learn from history, to be sure you make the same mistakes again...
Page 3 of 5 1 2 3 4 5

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

Gamestudio download | 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