Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
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
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 839 guests, and 5 spiders.
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 1 of 2 1 2
level_load - HeapAlloc vs VirtualAlloc #436684
01/31/14 09:39
01/31/14 09:39
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline OP
Serious User
Ch40zzC0d3r  Offline OP
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Hello laugh
If I try to load a big map twice my game crashes with a message:
"Out of memory"
I tried everything with nexus and so on but it wont simply work, so I decided finally to debug my game...
I traced some calls and came to this function:
Code:
10040B90



This function allocates memory for everything in my game (maps, models, strings, vars, and so on...)
It uses another function (the first call) which uses HeapAlloc.
I noticed when Im loading my map twice that this function returns an empty EAX/ESI which is normally the address where the map would be extracted and loaded, so the next JE condition is false and we wont jump past the error message "Out of memory". I forced the jump to jump and tried some different memory addresses for ESI, and yeah it worked. But I cant handle that without a debugger, because my hooks will make everything more unstable as it is now.
So, I read on the internet why the hell HeapAlloc can fail, and people said I should use VirtualAlloc instead of HeapAlloc for bigger files. It would be awesome if you could increase the size of the heap or use VirtualAlloc so I can load some larger maps with alot of models preloaded for my firstperson view. Thanks!

Last edited by Ch40zzC0d3r; 01/31/14 09:40.
Re: level_load - HeapAlloc vs VirtualAlloc [Re: Ch40zzC0d3r] #436688
01/31/14 11:17
01/31/14 11:17
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Everytime I got the "out of memory" error in the past while level loading my textures where too big. Use LOD textures in near distance and use DDS compression.

Re: level_load - HeapAlloc vs VirtualAlloc [Re: oliver2s] #436689
01/31/14 11:26
01/31/14 11:26
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline OP
Serious User
Ch40zzC0d3r  Offline OP
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
My weapons textures are DDS, but I cant recompile my level at the moment, also its "just" 180MB which is rather small for a game in this age..
The texture size is original size of CSS (source engine) which is not the newestalso (should be arround 512x512 but tga). I hope I can recompile my map and change textures (cuz importing source bsp maps is rather hard) Id love to see a fix for this thing too laugh

Re: level_load - HeapAlloc vs VirtualAlloc [Re: Ch40zzC0d3r] #436698
01/31/14 14:42
01/31/14 14:42
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
There is no "miracle function" that gets more memory out of your PC.

C/C++ programs use 'new' for implicit and 'malloc' for explicit memory allocation. What they do depends on the implementation, but under Windows both call HeapAlloc. Replacing that with VirtualAlloc would make no sense. You would get even more "Out of memory" messages, due to larger chunks. You normally don't call low level allocation functions anyway - malloc/new are supposed to use the optimal allocation method.

When you still have not enough memory for your game, your customers won't have either - so reducing the textures is indeed the first thing to do. Also replace vertex with bones animation.

Re: level_load - HeapAlloc vs VirtualAlloc [Re: jcl] #436701
01/31/14 15:13
01/31/14 15:13
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline OP
Serious User
Ch40zzC0d3r  Offline OP
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Well, the map is only 180MB and Ive got 8GB RAM + 12GB virtual RAM.
I dont see a reason why it shouldnt have anough memory frown
Thanks for your awnser anyways laugh

Re: level_load - HeapAlloc vs VirtualAlloc [Re: Ch40zzC0d3r] #436702
01/31/14 15:16
01/31/14 15:16
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Well, the obvious reason is then using >20 GB for your game plus the other tasks on your PC.

Re: level_load - HeapAlloc vs VirtualAlloc [Re: jcl] #436705
01/31/14 15:30
01/31/14 15:30
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline OP
Serious User
Ch40zzC0d3r  Offline OP
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
However, I saw that my nexus raises to 177915 on a near empty map, is that skill ok?
Im using DDs textures, but my guns need 8 textures and Ive got 30 guns shocked

Re: level_load - HeapAlloc vs VirtualAlloc [Re: Ch40zzC0d3r] #436708
01/31/14 15:49
01/31/14 15:49
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Depends on what's in your map - 177MB seems not so empty to me. But how the nexus rises is irrelevant here. It's allocated at start, so that memory is already gone. It's the further memory that you allocate during gameplay which can produce the "Out of memory" error.

Re: level_load - HeapAlloc vs VirtualAlloc [Re: jcl] #436710
01/31/14 16:15
01/31/14 16:15
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline OP
Serious User
Ch40zzC0d3r  Offline OP
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Im preloading evreything thats why my nexus is that hight without a map.
And yeah, the map is converted from CSS its not perfect done, WED was about to crash while compiling tongue

Re: level_load - HeapAlloc vs VirtualAlloc [Re: Ch40zzC0d3r] #436969
02/06/14 16:58
02/06/14 16:58
Joined: Jun 2008
Posts: 146
London
T
Truth Offline
Member
Truth  Offline
Member
T

Joined: Jun 2008
Posts: 146
London
I get the 'out of memory' message too. What I do to get around it is to use 'd3d_texlimit = 256;' which limits all the textures in the game to 256x256 thus using less memory. You can change it as low as 64 if you need

Page 1 of 2 1 2

Moderated by  old_bill, Tobias 

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