FreeImage() is not freeing image!
Displaying 1-12 of 12 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
the_shoeless_shoe

I have this textbox that a print to an image. Then, after it is done I blit the textbox onto screen. Then I free that image and we'd think everything to be a-cool.
But when I look at my memory usage, while that textbox is on screen, the memory used for verge skyrockets at a rate of 3megs/s, for each textbox on screen, and eventually the game become a big mess.
So i guess I have problems using FreeImage.
Here is what I did, in pseudo code.
start
declare boxImg;
loop
boxImg = newimage;
do thing with boxImg;
blit boxImg on screen;
freeImage boxImg;
showpage
end loop
end

Thanks for your help!

Posted on 2005-12-25 14:05:08

Gayo

Hmm, that looks like it ought to work. Maybe you could paste the actual code?

Posted on 2005-12-25 20:07:28

the_shoeless_shoe

Well, i tried a lot of things, and eventually I kept only the load image and freeImage, and though it took less memory, still it's growing at around 700k/s


void textbox(int x, int y, int x2, int y2)
{
int widthBox = x2 - x;
int heightBox = y2 - y;
int boxImg = NewImage (widthBox, heightBox);
FreeImage(boxImg);
}


textbox(), of course, being called in a loop.

if I take the two lines off, like that:

void textbox(int x, int y, int x2, int y2)
{
int widthBox = x2 - x;
int heightBox = y2 - y;
}


then it's allright, it doesn't take any memory at all (duh).

Posted on 2005-12-25 22:03:37

Jesse

FreeImage doesn't actually free any memory. That should probably be fixed.

Posted on 2005-12-25 22:04:50

CrazyAznGamer

Quote:
Originally posted by The Shoeless Shoe


Here is what I did, in pseudo code.
start
declare boxImg;
loop
boxImg = newimage;
do thing with boxImg;
blit boxImg on screen;
freeImage boxImg;
showpage
end loop
end

Thanks for your help!


What Jesse said is true, sadly. And a bit unnerving. However, memory use should be considerably reduced via this:
(pseudocode)
start
declare boxImg = newimage;
loop
do thing with boxImg;
blit boxImg on screen;
showpage
end loop
freeImage boxImg;
end


Look for the simple solution, Shoe-San.

Posted on 2005-12-25 22:39:45

the_shoeless_shoe

Oh. Well that explains it :)
Allright, thanks a bunch!

Posted on 2005-12-25 23:30:21

vecna

IN DEFENSE OF MY REPUTATION

This is a new bug. CONTRARY TO GAYO IT HAS NOT BEEN BROKEN FOR 2 YEARS. The source code I have on my computer (which is very old) looks like THIS:


void vc_FreeImage()
{
int handle = vc->ResolveOperand();
if (handle == 0)
vc->vcerr("vc_FreeImage() - cannot free a null image reference!");
if (handle == 1)
vc->vcerr("vc_FreeImage() - cannot free the screen reference");
if (handle<0 || handle>=MAX_IMAGES)
vc->vcerr("vc_FreeImage() - handle is a bogus reference!");
if (!imagebay[handle].active)
vc->vcerr("vc_FreeImage() - there is no allocated image associated with this reference!");
delete imagebay[handle].ref;
imagebay[handle].ref = 0;
imagebay[handle].active = false;
}


NOTE THE SECTION WHERE IT FREES THE IMAGE. I would also point out that in addition to actually freeing the image, it performed a plethora of helpful and useful checks that SOMEONE quite possibly ZEROMUS arbitrarily deleted! Not only is it a functional FreeImage, it is a damned fine FreeImage. AND NOW MY HONOR IS RESTORED AND I GO TO BED.

zzz

Posted on 2005-12-26 23:22:54

Jesse

It looks like when the resource handle mechanism was abstracted into the Handle class, the delete statement got lost. I wouldn't call it arbitrary deletion.

I don't think we need to blame people. And if we do, I blame Santa Claus. He's supposed to know who's naughty and nice, and this function was definitely naughty.

Posted on 2005-12-27 09:09:25

Gayo

We don't need to blame people, but it's fun and makes us feel better about ourselves.

Posted on 2005-12-27 23:15:20

resident

...Isn't being blamed for things Tarkuss's job?

Hail the legendary Tarkuss.

Posted on 2005-12-28 09:00:35

Overkill

Beware of the south!

Posted on 2005-12-28 10:31:38

mcgrue

Quote:
Originally posted by resident

...Isn't being blamed for things Tarkuss's job?

Hail the legendary Tarkuss.



Yes, for finding the very first major verge bug, he is forever nemesis.

...I've never heard that Tarkuss was at fault for anything. Anything other than abandoning Galaxy Destroyer, that is. :(

Posted on 2005-12-28 14:51:17


Displaying 1-12 of 12 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.