glBindTexture and memory

Under C++Builder I wrote the following code:

FILE ff;
textureim = new unsigned char [512
512*4];

ff=fopen("d:\\000.bma","rb");
 fread(textureim,128*128*4,1,ff);
fclose(ff);

glGenTextures(1, &backgr[0]);
glBindTexture(GL_TEXTURE_2D, backgr[0]);

I use GeneralMemoryStatus to watch how much memory I have left, like that:

	GlobalMemoryStatus(&ms);
    Edit1->Text=ms.dwAvailPhys;

When I reach the “glBindTexture” line, I see, that something eats up my memory. I tested all lines, but the memory ‘runs away’ only, if I use glBingTexture. If I make an ‘X-thousand-times’ loop, my prog will surely crash.
Is there a possibility to free the memory, allocated by glBindTexture, or is GlobalMemoryStatus wrong, or did I missed out something?

do you mean that if you do:
while(1) glBindTexture(GL_TEXTURE_2D, texid);
the memory run away ???

or the textureim = new unsigned char [5125124]; is included in the loop ???

glGenTextures(); will allocate memory to store the texture object’s informations (not the teximage, yet).
glBindTexture() only switches between those texture objects and shouldn’t increase the memory, well, except for the first usage in case the necessary few control informations like filter, priority etc. are allocated lazily in the driver or when you’re downloading the teximages for the first time.
Of course your memory will run out if you generate too many texture objects. Virtual address space is only 2 GB on Win32, so the possible ids itself would exceed that.
Use glDeleteTextures to cleanup unused texture objects. (Was that your question?)

[This message has been edited by Relic (edited 07-02-2003).]

So, You mean, if I use glDeleteTextures each time I have a glGenTextures, I will have the same quantity of memory? (if yes: right, that was my question!)
Thanx!