//FIXME: 05/01/06 com_zoneMegs is useless right now as neither q3config.cfg nor
// Com_StartupVariable have been executed by this point. The net result is that
// s_zoneTotal will always be set to the default value.
Here's the patch. A simple fix really, but testing it for side effects took quite some time.
--- code/qcommon/common.c.bak 2006-02-27 04:55:41.000000000 +0100
+++ code/qcommon/common.c 2006-02-27 05:18:19.000000000 +0100
@@ -2402,11 +2402,13 @@
// Swap_Init ();
Cbuf_Init ();
+ // 050227 misantropia -- make com_zoneMegs actually work
+ // override anything from the config files with command line args
+ Com_StartupVariable( NULL );
+
Com_InitZoneMemory();
Cmd_Init ();
- // override anything from the config files with command line args
- Com_StartupVariable( NULL );
// get the developer cvar set as early as possible
Com_StartupVariable( "developer" );--- code/qcommon/common.c.bak 2006-02-27 04:55:41.000000000 +0100
+++ code/qcommon/common.c 2006-02-27 05:18:19.000000000 +0100
@@ -2402,11 +2402,13 @@
// Swap_Init ();
Cbuf_Init ();
+ // 050227 misantropia -- make com_zoneMegs actually work
+ // override anything from the config files with command line args
+ Com_StartupVariable( NULL );
+
Com_InitZoneMemory();
Cmd_Init ();
- // override anything from the config files with command line args
- Com_StartupVariable( NULL );
// get the developer cvar set as early as possible
Com_StartupVariable( "developer" );
(In reply to comment #1)
Hurray for debug builds of your favourite browser. Here's the correct patch:
--- code/qcommon/common.c.bak 2006-02-27 04:55:41.000000000 +0100
+++ code/qcommon/common.c 2006-02-27 05:24:01.000000000 +0100
@@ -1385,10 +1385,6 @@
void Com_InitZoneMemory( void ) {
cvar_t *cv;
- //FIXME: 05/01/06 com_zoneMegs is useless right now as neither q3config.cfg nor
- // Com_StartupVariable have been executed by this point. The net result is that
- // s_zoneTotal will always be set to the default value.
-
// allocate the random block zone
cv = Cvar_Get( "com_zoneMegs", DEF_COMZONEMEGS_S, CVAR_LATCH | CVAR_ARCHIVE );
@@ -2402,11 +2398,13 @@
// Swap_Init ();
Cbuf_Init ();
+ // 050227 misantropia -- make com_zoneMegs actually work
+ // override anything from the config files with command line args
+ Com_StartupVariable( NULL );
+
Com_InitZoneMemory();
Cmd_Init ();
- // override anything from the config files with command line args
- Com_StartupVariable( NULL );
// get the developer cvar set as early as possible
Com_StartupVariable( "developer" );
This only fixes the case where com_zoneMegs is set on the command line. Notice the comment above the call to Com_StartupVariable is bogus; there are no config files loaded at this point to be overridden.
This isn't really a feasible bug to fix in the general case however since in order to initialise zone memory you need to know the size, but to get the size you need to have a config file loaded, to load a config file you need to have the filesystem initialised and to initialise the filesystem you need zone memory intialised. In other words a cyclic dependency.
The only way I can really see of resolving this is to mung the zone memory system to support the use of multiple (system) malloced pools such that the total size of zone memory can be dynamically altered. This is particularly non-straightforward however and is clearly overkill to fix this bug.
It's tempting just to bump set s_zoneTotal to a default and remove the com_zoneMegs cvar altogether. Memory is cheap these days and any use case that needs more than 20 odd Mb of dynamic memory really ought to go on the hunk in the first place.
Anyway, I'll think about it a bit more. I guess this patch has some merit, but it doesn't really address the problem fully.
By the way, it's better to create an attachment (see the Create a New Attachment link) for patches rather than pasting them into the comment.
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.
--ryan.
Having this work on the command line is better than having it work nowhere, so I think it's worthwhile even if it doesn't work in config files.
A modified version of this patch is now svn revision #1590.
--ryan.
Here's the patch. A simple fix really, but testing it for side effects took quite some time. --- code/qcommon/common.c.bak 2006-02-27 04:55:41.000000000 +0100 +++ code/qcommon/common.c 2006-02-27 05:18:19.000000000 +0100 @@ -2402,11 +2402,13 @@ // Swap_Init (); Cbuf_Init (); + // 050227 misantropia -- make com_zoneMegs actually work + // override anything from the config files with command line args + Com_StartupVariable( NULL ); + Com_InitZoneMemory(); Cmd_Init (); - // override anything from the config files with command line args - Com_StartupVariable( NULL ); // get the developer cvar set as early as possible Com_StartupVariable( "developer" );--- code/qcommon/common.c.bak 2006-02-27 04:55:41.000000000 +0100 +++ code/qcommon/common.c 2006-02-27 05:18:19.000000000 +0100 @@ -2402,11 +2402,13 @@ // Swap_Init (); Cbuf_Init (); + // 050227 misantropia -- make com_zoneMegs actually work + // override anything from the config files with command line args + Com_StartupVariable( NULL ); + Com_InitZoneMemory(); Cmd_Init (); - // override anything from the config files with command line args - Com_StartupVariable( NULL ); // get the developer cvar set as early as possible Com_StartupVariable( "developer" );