Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / What's happenning? Runtime error: failed to create new bitmap

Author
Message
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 30th Apr 2008 12:02
I run the tutorial example "Game Level" several times in debug mode before.
Then I run it again.
And suddenly this time a message pops up:
"Runtime error: failed to create new bitmap"

The result is that the scene doesn't has any texture shown.
And everything runs slowly.

I wonder what is happening?

When I reboot, it can run again. And after I have run it several times, the same problem appears again.

Seems other game projects created by myself doesn't has such problem.

Can anyone explain it?
How to avoid it?

Thanks.
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 30th Apr 2008 13:12
You are not releasing all of the resources that the program is using. That happens for many reasons, but I think it could be:

1. You are terminating the application in some sort of abnormal way. Either it is crashing, or you are using Task Manager, or another way of terminating it in a non-statndard way.

2. You are not properly releasing the memory on your graphics card. This is more related to your card/driver, but it never hurts to flush the video memory before exiting your application.

3. You are not properly releasing memory you have allocated, or that was allocated on your behalf, or you are not releasing a reference counted resource properly.

So, my stab in the dark is :
Always end the application gracefully, using escape, or the 'x' button, and make sure to call flush video memory before exiting.
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 30th Apr 2008 17:03
First, thanks for your reply.

I have use dbDeleteObject()to free all created objects and use dbFlushVideoMemory() to free level textures.
I also use esc or x button to end the application.
But the problem still exists. So sad.

Any other solution?
tobi453
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location:
Posted: 30th Apr 2008 21:04
Try to compile in release mode.

FINAL VERSION RELEASED!!!!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 30th Apr 2008 21:13
JenZai, You know if flush video memory would be beneficial when your app STARTS and WHEN IT FINISHES.. to 1: Clean out other people's stuff, then clean up after yourself?

Would you recommend this? Say the word and I'll implement it as a matter of SOP (Standard operating Procedure) (You seem to know quite a bit about this and DarkGDK)

jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 30th Apr 2008 23:57
Yes, I do that, too. (I call it right after set display mode, which should make it redundant.) btw, I was in the military...and know about SOP (Helps keep things from going all FUBAR)

...then, I'd have to return to the other (non-3D, mostly) resources that you are using. What is different about this app? Are you using any TPC DLLs, or perhaps you might be using some Windows components that the other apps are not using? Also, you might have a project setting that is causing this to happen. Using new without delete will also leak memory.

In short, check everything. If possible, post it up so we can look under the hood. Perhaps you've exposed a leak that needs to be plugged.
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 1st May 2008 05:59
I have only added several lines to the tutorial example "Game Level", here is the Main.cpp code:


I think it is the .dbo file that makes this memory leak problem.
Because I have tried to comment out load the dbo file and the .x skybox works very well.
But when I added back the dbo file, the problem was back.
The .dbo file was made by WorldStudio and it is consisted of many components. It's quite complex. The textures are put in several sub directories so that it can't be freed cleanly?
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 1st May 2008 06:15 Edited at: 1st May 2008 06:25
I am more concerned with the skybox.

You should not need to texture it as the x file should already contain the textures (There are 5 for that skybox.). Then you are setting the object texture again using an image number that I don't see being loaded anywhere (3), and using a mipmap flag. ?
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 1st May 2008 06:48
The basic code are given by Dark GDK.

I only added the codes that I've made comment "added by Carlos" to it.

So I don't know whats wrong with this tutorial example.
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 1st May 2008 07:20 Edited at: 1st May 2008 07:21
@Jinzai: dbSetObjectTexture does not retexture the object but merely changes the texture modes... This step is included in the tut and I have tried the tut myself and it worked absolutely fine... And aren't there six textures for a normal skybox that are bitmap's labelled 1,2,3... and so forth? I thought that was the case with skyboxes...

@Carlos: I don't know why it would say failed to create NEW bitmap as you are not creating any new bitmaps and I have tried this tut with perfect success myself... And did YOU model a NEW level? because the level in the tut I thought was exported from FPSC... That's what it said in the tut...

@All: If it any time I sound like an idiot who doesn't know what he's talking about forgive me...

~~It's not who you are underneath, but what you do that defines you.~~
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 1st May 2008 08:11
@Core2uu: I didn't make any change to the media. I guess the problem was caused by the .dbo level. Have you tried to run the Game Level example in debug mode continuously for at least 4 times before? I found that after I have run 4 times, the problem appears because due to failing to free the video memory(My graphics card is ATI RADEON XPRESS 200 and I use Windows XP SP2).
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 1st May 2008 08:22
I have ,and my GFX card is crappier than yours so you can't blame your GFX card... Maybe try a different .dbo and see if that works...

~~It's not who you are underneath, but what you do that defines you.~~
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 1st May 2008 08:34
I'd try saving and restoring the display mode, too. I think it is important to get your card reset somehow on exit.

Core2uu, that's right, I was confused about that! (But, that mipmap flag does change how the GPU memory is used for that texture.)

Some skyboxes (ones used with terrain?) have 5, others 6.
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 2nd May 2008 00:07
Quote: "I think it is important to get your card reset somehow on exit."


Either that or you can restart your computer... lol...

Carlos, try changing the mipmap flag and see if that helps... If you have another computer try it on that with the exact same code as you posted up to see if the problem is with your machine or the code... or you could try a different level...

~~It's not who you are underneath, but what you do that defines you.~~
Carlos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 2nd May 2008 13:36
I tried another dbo level exported with DeleD 3D Editor and it works very well. No memory problem.
So I believe that it is the dbo file that Dark GDK provides causing the memory problem.
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 3rd May 2008 03:39
All's well and working then...

~~It's not who you are underneath, but what you do that defines you.~~

Login to post a reply

Server time is: 2024-09-29 19:24:40
Your offset time is: 2024-09-29 19:24:40