Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

question about stack for screen

Hi All,

 

As you know, when we want disply a screen,

 

we use App.pushScreen and put screen into application stack.

 

what i am curious is if user popScreen, and that screen will never be used.

 

will it be garbage-collected?

 

Thanks.

 

for example:

 

1st:  AScreen was pushed and displayed on top.

2ed: BScreen was pushed and displayed on top.

         *as you know, AScreen is in stack, when BScreen was closed, it will always show AScreen.

3rd: CScreen was pushed and displayed on top.

 

In this case, User directly pushes AScreen to top from CScreen.

 

then application runs on background, and never user BScreen.

 

 

is BScreen always in applicaiton memory?

Do I need to garbage-collect BScreen explicit?

 

Thanks.

 

 

 

 

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: question about stack for screen

Hi Jeff_Lu,

 

I think you will be better served with your question on the Java forums.. 

 

Would you like me to move it there?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: question about stack for screen

for sure,

 

it is my fault.

 

Thanks.

Please use plain text.
Developer
peter_strange
Posts: 19,604
Registered: ‎07-14-2008
My Device: Not Specified

Re: question about stack for screen

In the scenario you have suggested, if B Screen is on the Display Stack, it will not be garbage collected. 

 

I suspect you have a more complicated scenario in mind.  Please fire away....

Please use plain text.
Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: question about stack for screen

Thanks Peter,

 

I'd appreiciate youir answer.

 

what about pop up dialog?

 

work mechanism of dialog sounds same as screen mechanism.

 

and about the scenrio that i posted, I want to garbage collect that BScreen, How to do it?

 

Keep Object handler and then set it to null?

 

Thanks.

Please use plain text.
Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: question about stack for screen

it is my misunderstanding.

 

since dialog was closed, and then it will be collected.

 

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: question about stack for screen

Closing or popping a screen screen will not necessarily result in gc. If you retain a reference to the screen object, then it remains instantiated.

 

Please use plain text.