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

Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

FileConnection close() not called

I have encountered a weird problem where data written to one file, ends up written into a different file that was opened for playing by the BB media player.


I am trying to debug the problem, and I got a question that I could not find it in the documentation.

If a file is opened using FileConnetion.Open(), then an outputStream is opened, written to and closed.

But the FileConnetion.Close() is not called.

What can possibly happen if this is done many times? Also when the garbage collection is called on the FileConnection, does it close it?






BlackBerry Development Advisor
Posts: 15,349
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: FileConnection close() not called

Failing to close connections can result in an application holding onto resources and cause a memory leak.  Please see the following link for a sample on how to properly close connections.


How To - Close connections 
Article Number: DB-00530


Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker