Well, seeing as this thread is probably all my fault, I had better speak up.
Below you will find a simple standalone script I would like you guys to test for me...
But I need all types of OS and GS versions combinations please... I shall explain...
The following code is RECONSTRUCTED from memory (as best as possible) of the
code that originally spawned this 'memory-leak' idea in my head.
(I know its not a REAL memory leak, but I'll call it that for simplicity).
I originally designed the below code as a CRUDE test of memory consumption
WAAAY back in preparation for a (still un-born) major project.
But, seeing as it failed the test by un-expectedly exposing the memory leak.
This was followed by months of racking the forum, annoying JCL, and much code-hacking.
In the end, there was no known CURE... So I then embedded knowledge of this leak
deep in my brain so I would always program 'around' it, by reflex as it were.
Now its back... as it resurfaced whilst discussing a sub-system with Carlos.
But, then he goes and exposes my belief to be unfounded... The BLASPHEMER!
But ALAS! He was correct! It has taken me TWO days of coding and re-coding to
be able to reproduce my original problem... Then a few more hours to whittle
the code down to something you guys can interpret and test...
WHY was it so hard to reproduce you say?
Well, its been so long since I discovered this problem, that I had forgotten
it was back in A7 days.... I needed to load up and old version of gamestudio(7.80)
in order for the fault to occur... It doesnt appear in A8.
You hear that Carlos? A8 is clear!! You can ignore all I ranted on about...
So here is what Im hoping for from you guys, because I dont have ANY computers
that have NEVER EVER had A8 installed. (I want to exclude possible C-runtime conflicts).
I want to find someone running XP and A7, and someone with Windows7 and A7.
Ensuring those machines have never had A8 (C+ runtime portion) installed...
I suppose some A8 versions wouldnt hurt, especially if any fail...
Thanks muchly for this mission, should you choose to accept it...
And my apologies if my flawed (or at least outdated) beliefs have cause you grief...
And so... the code ...
Just run it and hit F11 to bring up the stats panel. No external files needed.
Once you have observed its pattern of processing and memory consumption,
hold either SHIFT key to enable ent_clone which triggers the leak.
If it is LEAKING, the memory will climb and never come down, even if you release shift,
and it MAY even reach a point where acknex crashes with an 'out of memory' error.
But if it is OK, holding shift will make the memory clime to a peak and hold there,
and the memory will 'slowly' fall back to a nominal value when you release shift...
Have Fun....
#include <acknex.h>
#include <default.c>
#define BANK_SIZE 1000
ENTITY* test[BANK_SIZE];
void main()
{
max_entities = 1000;
level_load(NULL); wait(3); vec_fill(camera.x,0); //fps_max = 60;
camera.z=100; vec_fill(camera.pan,0); camera.tilt-= 90;
//--------------------------------------------------------------------------------------
int l, i, count=0; for(i=0; i<BANK_SIZE; i++) { test[i]=NULL; }
//
while(1)
{ for(l=0; l<20; l++)
{ for(i=0; i<(BANK_SIZE/20); i++)
{
// create a random model
if (random(3)>2)
test[i+(l*(BANK_SIZE/20))] = ent_create(SPHERE_MDL, nullvector, NULL);
else if(random(3)>2)
test[i+(l*(BANK_SIZE/20))] = ent_create(CUBE_MDL, nullvector, NULL);
else
test[i+(l*(BANK_SIZE/20))] = ent_create(SHADOW_DDS, nullvector, NULL);
//
//-----------------------------------------------------------------------------
//
// hold shift key to enable ent_clone, this triggers the problem...
if(key_shift) { ent_clone(test[i+(l*(BANK_SIZE/20))]); }
//
//-----------------------------------------------------------------------------
//
// systematically ent_remove entities that have been around for a while
if(test[i+(cycle(l+1,0,20)*(BANK_SIZE/20))])
{ ent_remove(test[i+(cycle(l+1,0,20)*(BANK_SIZE/20))]); }
//
count++;
}
DEBUG_VAR(count, 100);
wait(1);
}
}
}
Thanks again...