I'm in need of help

BlitzMax Forums/BlitzMax Beginners Area/I'm in need of help

Sanctus(Posted 2006) [#1]
Hi i know BlitzMax kinda good but I have a lot of leaks and I was wondering if anyone here(more experienced) would wanth to help me on yahoo messenger...
I basicaly know more Blitz2d code and recently moved to BlitzMax(thats why I have the leaks)
Pls post a ID if you wanth to help me


Brendane(Posted 2006) [#2]
Are you using Strict mode and declaring you variables like this?

Local myVariable:MyType = new MyType
Local myImage:TImage = LoadImage("...")

OR are you declaring them like this :-

Local myVariable = new MyType
Local myImage = LoadImage("...")


Sanctus(Posted 2006) [#3]
I do them like this:
Local myVariable = new MyType
Local myImage = LoadImage("...")


Yan(Posted 2006) [#4]
I can probably cure 99.99% of your leaks with one short sentence...

'Replace all your integer object handles with proper objects.'

So, don't do things like this...
Local image = loadImage("myimage.png")

Do this instead...
local image:TImage = LoadImage("myinage.png")



[edit]
Luv a duck!.../me orders some 'New Improved Speedy Fingers(TM)'
[\edit]


Brendane(Posted 2006) [#5]
Ok.

Are you calling Release() on those variables at any point?

When do don't declare the variable with it's proper type
ie. this :-
Local myImg = LoadImage("..")

instead of this:-
Local myImg:TImage = LoadImage("..")

.. you create what is called an integer reference to the object. That is, the variable myImg is Int (and not TImage). These references MUST be released with a call to Release() when you are done with them, or you get a leak.

However if you were to do this :-

Local myImg:TImage = LoadImage("...")

myImage is now automatically garbage collected when it is not longer in scope (you basically don't need to worry about it after you've created it).

[edit]
Cor blimey Yan! you out-typed me!
[/edit]


Dreamora(Posted 2006) [#6]
Another reason to use proper types: They are much faster!


Sanctus(Posted 2006) [#7]
hm.. the topic was about anyone would wanth to give me and ID so that I might directly ask him/her somefin if I get in trouble...
pls....


tonyg(Posted 2006) [#8]
Your decision.
However this forum has lots of people who could help you if you need help without the chance of that 'special someone' being busy when you need them.