Jump to content
Sign in to follow this  
qubits

When free isn't free anymore..

Recommended Posts

Hello Everyone,

newb here, sorry..

 

Has something big changed since berlin?

 

have to ask as since it's release iv'e been coding like mad.

trying to move into d11 for android 11 support.

 

berlin

windows no issues, when i first ported to android blindly like a mad man.

nope didn't run, no modal windows.. so re-design..

 

one form3d, everything is dynamically created..

this is just one piece of a larger puzzle about 60k lines.

put scenes into separate classes, used class(tdummy)

again windows, beautiful, first go on android..

everything piled up.. oops, ok..

free isn't free, must use disposeof

so changed all my freeandnils to disposeof and nil.

success, running good on cheap android 10 tab and tv box.

 

wouldn't work on my phone though, as it was android 11, quick look, need to update.

 

got my Delphi 11 loaded.

help file was from older version.

loaded my project and no, i didn't do what i had should have done.

notice that after i fixed my help files.

so anyways, loaded my app, loaded right up.

compile, 2 errors.. screen height and width are now singles, cool, trunc.

 

recompile, success.

launch on windows, perfectly.

android, memory errors.

launches but no way somethings wrong mission control, abort, abort..

 

so i see, free and dispose are the same again or not??

 

i changed all my disposeof and nils to free then nil

no luck.

put cleanup routines on my scenes, unrolling everything.

my destructors are bigger than my constructors.

 

i will say this, when moving back to free and nil i found i had a bug.

one of my scenes, i removed an object by commenting it out in the creation but had still left the dispose of in place.

no problems reported with berlin/d11 on win or android

using free i get access violation as expected.

So,kind of curious, what happens when you disposeof something that is not created..

either way back now using CleanUp Free Nil on all my objects but still something is not right here.

 

I'll keep at it, don't see anyone talking firemonkey3d.

i use tdummy,trectangle3d,tsphere,ttext3d,timage3d and that's about it.

 

i must have some reference still dangling.

bit of an old timer if you haven't already guessed it, sorry..

 

love delphi, since delphi1.

 

sorry for the rant, just needed a break..

 

but please, if there is some magic thing im suppose to already know, please tell me..

 

i saw the DisposeOfAndNil, i was like omg, that's was a long dark tunnel that led no where..

 

again, sorry for the long rant..

 

happy holidays everyone!!

 

~dave

 

 

 

 

 

 

 

 

 

 

 

 

 

Share this post


Link to post

Since Delphi 10.4 memory management across all platforms has been unified. That means Free and FreeAndNil behave on android just like then always behaved on Windows.

 

There is still DisposeOf, but it just calls Free now. You can change those calls, but you don't have to. The only place where you can have leaks on Android due to this change is if you have been relying on ARC to release your objects and you were just assigning nil to them or you were just letting them go out of scope.

Share this post


Link to post

Hi,

Thanks for the reply and yes, saw that, been trying a bit of everything..

getting closer i think..

looks like might be an issue with TText3d..

setting text seems to trigger a 4 meg buffer creation..

i get this same error, but could be in different area of app..

always same though, start with a TText3d text change, then boom!!

 

Going to buy you book, looks like a good read..

 

thanks!!

 

~dave

 

 

CallStack.jpg

Share this post


Link to post

Still my Berlin Enterprise, no issue.. yes, it's under arc, which i had thought i had figured out. nil was my new best friend.

Now, under D11 pro, kinda broke couldn't afford the enterprise as of yet, but I'm starting to think nil is killing me somehows..

 

FPixelFormat more than 2 billion, maybe that's the high dpi everyone is complaining about..

FHeight is really, really tall and my FWidth is 0.. really skinny..

no idea what this Pitch is, but she's pretty big too..

It can happen during creation, like this stack pic or when im refreshing a scene and just changing text..

boom the tall skinny pitch's me..

curious, if there's no width, why the 4 meg buffer.. i did see something about a scale im using ScreenCam so im at 1 not 10.

really wish it would happen on windows, maybe i could step through it..

 

too me, it looks like i gave delphi a nil that it didn't like.

 

 

Share this post


Link to post

so, hate jumping the gun..

but so far, so good..

 

so yes, from berlin to d11..

 

nil is now my enemy again..

 

all my scenes where created with, my use to be friend nil..

i was just setting the parent and usually after the creation..

 

TText3d does not appreciate this anymore too much..

causes the tall skinny to pop up and pitch you.. 🙂

 

still need to go through everyone a few more times, really make sure my stability is back..

funny, been watching my berlin compiled app running like a tank this whole time i've been fighting..

 

still have to decide, do i get lazy again and not unroll fully everything i roll and just free and nil..

or nil,nil,nil then free and and nil again..

 

so, saying goodbye to my dear old friend nil, you helped me with arc and i thank you for that and wish you well..

 

happy coding everyone!!

 

 

 

Share this post


Link to post

sorry.. better, but no..

might not like being invisible and changing, very obscure..

same thing as first stack trace, but much better..

was crashing on most scene transitions and creations..

probably Z messing with me or something completely offtrack that causes it, always bombs trying to build a bitmap for a string..

will say this, it's faster, allot..

i know it's something im doing, made small test program to see if i could reproduce and couldn't, then it started getting big..

earth spinning, moon in orbit and a borg ship of course.. spinning the borg was a bit choppy, but i'll be getting back to all that soon..

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×