<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BlackBerry Developer Blog &#187; Kamen V.</title>
	<atom:link href="http://devblog.blackberry.com/author/kamenv1/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.blackberry.com</link>
	<description></description>
	<lastBuildDate>Fri, 17 May 2013 17:47:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='devblog.blackberry.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/9ef0a66c09615fa946c4179662398878?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>BlackBerry Developer Blog &#187; Kamen V.</title>
		<link>http://devblog.blackberry.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://devblog.blackberry.com/osd.xml" title="BlackBerry Developer Blog" />
	<atom:link rel='hub' href='http://devblog.blackberry.com/?pushpress=hub'/>
		<item>
		<title>How To Find That Memory Leak (Part Three): Why An Object is Leaking Into Memory</title>
		<link>http://devblog.blackberry.com/2010/03/how-to-find-that-memory-leak-part-three/</link>
		<comments>http://devblog.blackberry.com/2010/03/how-to-find-that-memory-leak-part-three/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 10:00:00 +0000</pubDate>
		<dc:creator>Kamen V.</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[memory leak]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[weak-reference]]></category>

		<guid isPermaLink="false">http://devblog.blackberry.com/?p=931</guid>
		<description><![CDATA[Investigating the cause of application memory leaks on BlackBerry smartphones. Part three in a three part series. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=931&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-982" title="Hunting a memory leak" src="http://rimdevblog.files.wordpress.com/2010/03/blackberry-memory-leak.jpg?w=558&#038;h=416" alt="" width="558" height="416" /></p>
<p>This is the third of a three-part series on how to detect a memory leak.  In <a title="Find That Memory Leak - Part One" href="http://rimdevblog.files.wordpress.com/2010/03/blackberry-memory-leak-mobile.png2009/10/how-to-find-that-memory-leak-part-one/">part one</a>, I explained the most common cases for a memory leak in a Java® development environment, and how that can affect your application. In <a title="Find That Memory Leak - Part Two" href="http://rimdevblog.files.wordpress.com/2010/03/blackberry-memory-leak-mobile.png2010/01/how-to-find-that-memory-leak-part-two-detecting-the-leak/">part two</a>, I discussed how to detect potential leaks. Today, we’re going to investigate why an object is leaking into memory in the first place.</p>
<p><span id="more-931"></span></p>
<h2>Leak investigation</h2>
<p>Once you&#8217;ve identified the class name of the object that is leaking, open the object&#8217;s view &#8211; View/Objects. This view allows viewing all class instances currently on the BlackBerry® smartphone. Before proceeding, press the &#8220;GC&#8221; button to clean any unreferenced instances (you may have done this already in the Object Statistics view, but doing it again doesn’t hurt). Starting with the BlackBerry® Java® Development Environment (BlackBerry JDE) v4.6, you can take advantage of a convenient functionality that lets you show all recursive references to an instance. <strong>So if you&#8217;re using BlackBerry JDE 4.6 or newer, follow the set of instructions below; otherwise look at the second set of instructions.</strong></p>
<ol>
<li>In the &#8220;Type:&#8221; field, enter the name of the class you&#8217;re after &#8211; e.g. &#8220;TestMemoryLeaks&#8221; &#8211; and press enter.  You will get a list of instances &#8211; these are the actual &#8220;leaks&#8221;.</li>
<li>Pick one of those instances in the objects view, right-click and choose “Show Recursive References”. This will yield a very large list of objects (everything that references your object, directly or indirectly).</li>
<li>In the “Location” dropdown, select “Root Objects”. This will restrict the view to root references only (static variable, persistent root, app registry, local variables, etc).</li>
<li>One of the instances in the list will be of a class called ApplicationRegistryHashtable. Right click on it and choose “Show paths from @xxxxxx to @yyyyy”.</li>
<li>Now you have the reference chain that causes the leak.</li>
</ol>
<p><strong>If you have a version of the BlackBerry JDE older than 4.6, use the following steps:</strong></p>
<ol>
<li>In the &#8220;Type:&#8221; field, enter the name of the class you&#8217;re after &#8211; e.g. &#8220;TestMemoryLeaks&#8221; &#8211; and press enter.  You will get a list of instances &#8211; these are the actual &#8220;leaks&#8221;.</li>
<li>Pick one of those instances in the objects view, right-click and choose “Show References to @xxxxxxx”. This will give you a list of immediate references.</li>
<li>Check if one of the instances in the list is not ApplicationRegistryHashtable. If it is then go to step 6.</li>
<li>Right-click on any item in the new list and select &#8220;Show References To This Object List&#8221;. This will give you another list.</li>
<li>Repeat steps 3 and 4 until you reach an instance of ApplicationRegistryHashtable.</li>
<li>Right-click on ApplicationRegistryHashtable and choose “Show paths from @xxxxxx to @yyyyy”.</li>
<li>Now you have the reference chain that causes the leak.</li>
</ol>
<p>Having the reference chain to the leaked object instance should provide you with enough information about what caused the problem, and to avoid it.</p>
<p>So enough reading, hunters &#8211; minimize this browser and go back to your BlackBerry JDE to start the memory leak hunt! After that, come back and share your experience with everyone by posting a comment. Have you found any leaks? What were the core reasons for having the leaks on the first place? Let us all know.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/931/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/931/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=931&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2010/03/how-to-find-that-memory-leak-part-three/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/832dccdac0a9f32971905af91e11034e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamenv1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2010/03/blackberry-memory-leak.jpg" medium="image">
			<media:title type="html">Hunting a memory leak</media:title>
		</media:content>
	</item>
		<item>
		<title>How To Find That Memory Leak (Part Two): Detecting The Leak</title>
		<link>http://devblog.blackberry.com/2010/01/how-to-find-that-memory-leak-part-two-detecting-the-leak/</link>
		<comments>http://devblog.blackberry.com/2010/01/how-to-find-that-memory-leak-part-two-detecting-the-leak/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 15:49:20 +0000</pubDate>
		<dc:creator>Kamen V.</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[memory leak]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[weakreference]]></category>

		<guid isPermaLink="false">http://blackberrydev.edstaging.com/?p=24</guid>
		<description><![CDATA[In part one of our memory leak how to series, I explained the most common cases for a memory leak in a Java® development environment, and how that can affect your application. Today we’ll discuss how to detect potential leaks. Application memory leaks are usually not that easy to find &#8211; the application may need [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=24&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In <a href="http://supportforums.blackberry.com/t5/BlackBerry-Developer-s-Blog/How-to-find-that-memory-leak-Part-One/ba-p/367133">part one of our memory leak how to series</a>, I explained the most common cases for a memory leak in a Java® development environment, and how that can affect your application. Today we’ll discuss how to detect potential leaks.</p>
<p>Application memory leaks are usually not that easy to find &#8211; the application may need to be left running for a while, may need to be started multiple times, or specific application logic may need to get exercised repeatedly. If you suspect a memory leak then the first step is to start monitoring the device&#8217;s free memory &#8211; Options/Status/File Free. A more reliable way to monitor device memory usage is through the memory tools that can be found in the BlackBerry® Java® Development Environment (BlackBerry JDE) when connected to either the simulator or a real device. To use them you need to break the execution through a breakpoint or through the menu &#8211; Debug/Break. Once the execution has been suspended go in the View menu where you will find two tools of particular interest &#8211; Memory Statistics and Object Statistics.<span id="more-24"></span></p>
<p>The <strong>Memory Statistics</strong> show a detail breakdown of the memory that&#8217;s being used:</p>
<p><img src="http://rimdevblog.files.wordpress.com/2010/01/memleak16.png?w=600&#038;h=177" alt="" title="How To Find That Memory Leak (Part Two): Detecting The Leak" width="600" height="177" class="aligncenter size-full wp-image-5811" /></p>
<p><strong>Columns</strong></p>
<ul>
<li>objects &#8211;  displays the number of objects that are currently in memory</li>
<li>Bytes in use &#8211; displays the amount of memory that is used by Java® objects</li>
<li>Allocated &#8211; displays the total memory that is allocated to the VM</li>
<li>Free &#8211; displays the memory that is available</li>
</ul>
<p><strong>Rows</strong></p>
<ul>
<li>Transient objects  &#8211; displays the number of transient objects in flash memory</li>
<li>Persistent objects &#8211; displays the number of persistent objects in flash memory</li>
<li>Code modules &#8211; displays the number of code modules in flash memory</li>
<li>Flash &#8211; displays the sum of the other three rows</li>
</ul>
<p>Pressing Refresh will populate the table with data. Press Snapshot to save the data in a snapshot. Next resume the execution and perform the steps that you suspect of causing memory leaks .The more memory leaks you manage to accumulate the easier it would be spot them so be bold here. Now break the execution again, press Refresh on the Memory Statistics window, and select &#8220;Compare to Snapshot&#8221; . This should show you the difference between the current memory statistics and the snapshot you previously created.</p>
<p>Another tool that you can use is the <strong>Object Statistics tool</strong> under the View menu. First press the &#8220;GC&#8221; button to make sure all object instances that are not referenced are freed up. Then sort the table by &#8220;Number of instances&#8221; and use the &#8220;Type:&#8221; field to filter them by your application&#8217;s package name. Look for classes that have more instances that you expect them to have:</p>
<p><img src="http://rimdevblog.files.wordpress.com/2010/01/memleak27.png?w=600&#038;h=201" alt="" title="How To Find That Memory Leak (Part Two): Detecting The Leak" width="600" height="201" class="aligncenter size-full wp-image-5815" /></p>
<p>Now you should be ready to proceed with investigating why an object is leaking into memory. We’ll deal with this issue in part three of our series, so stay tuned!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=24&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2010/01/how-to-find-that-memory-leak-part-two-detecting-the-leak/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/832dccdac0a9f32971905af91e11034e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamenv1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2010/01/memleak16.png" medium="image">
			<media:title type="html">How To Find That Memory Leak (Part Two): Detecting The Leak</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2010/01/memleak27.png" medium="image">
			<media:title type="html">How To Find That Memory Leak (Part Two): Detecting The Leak</media:title>
		</media:content>
	</item>
		<item>
		<title>How to find that memory leak! (Part One)</title>
		<link>http://devblog.blackberry.com/2009/10/how-to-find-that-memory-leak-part-one/</link>
		<comments>http://devblog.blackberry.com/2009/10/how-to-find-that-memory-leak-part-one/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 17:39:03 +0000</pubDate>
		<dc:creator>Kamen V.</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[memory leak]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[weakreference]]></category>

		<guid isPermaLink="false">http://blackberrydev.edstaging.com/?p=236</guid>
		<description><![CDATA[Releasing an application with a memory leak can be one of the most embarrassing moments for a developer in the application’s lifecycle. Since mobile devices tend to have less free memory than a PC, the impact of a memory leak becomes more pronounced. Following the steps below will help ensure developers don’t encounter this situation [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=236&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Releasing an application with a memory leak can be one of the most embarrassing moments for a developer in the application’s lifecycle. Since mobile devices tend to have less free memory than a PC, the impact of a memory leak becomes more pronounced. Following the steps below will help ensure developers don’t encounter this situation when developing their application for BlackBerry® smartphones.</p>
<p><strong>Leaks? What leaks?</strong></p>
<p>Let’s start by clarifying how developers can end up with a memory leak in a Java® development environment. The Java Virtual Machine performs garbage collection on demand which frees up memory allocated by objects not referenced by anything else in the system &#8211; this puts Java applications in a better position than applications in a development environment like C++, for example. However, when an object that&#8217;s not needed anymore is left referenced by another object in your application, the JVM system has no way to know that this object should be freed up. This is especially true if instances of such an object get accumulated over time.</p>
<p><span id="more-236"></span></p>
<p>Our experience with BlackBerry development shows that in practice one of the most common cases for the creation of a memory leak is when registering listeners for system-wide events &#8211; for example, when registering your own email folder using <a title="ApplicationMessageFolderListener" rel="nofollow" href="http://www.blackberry.com/developers/docs/4.7.0api/index.html" target="_blank">ApplicationMessageFolderListener</a>.  However, a memory leak can be created by just adding an object instance to the global runtime store and never removing it. Here is a very simple application that creates a new leak every time it is started:</p>
<div class="sample"><code>import net.rim.device.api.system.Application;<br />
import net.rim.device.api.system.RuntimeStore;<br />
import java.util.Random;</p>
<p>class TestMemoryLeaks {<br />
    public static void main(String[] args) {<br />
        //create a memory leak by adding an item to the runtimestore and never removing it<br />
        RuntimeStore store = RuntimeStore.getRuntimeStore();<br />
        store.put((new Random()).nextLong(), new TestMemoryLeaks());<br />
    }<br />
}</code></div>
<p>Of course, memory leaks can also exist within the scope of an application, but their impact is limited since they will be eliminated when the application terminates (unless the application is designed to always run in the background). In this category also fall all implementations of listeners registered for application-wide scope &#8211; for example <a title="AccelerometerListener" rel="nofollow" href="http://www.blackberry.com/developers/docs/4.7.0api/index.html" target="_self">AccelerometerListener</a>. For such listeners, the underlying system uses <a title="WeakReferences" rel="nofollow" href="http://www.blackberry.com/developers/docs/4.7.0api/index.html" target="_self">WeakReferences</a>; when the application terminates and no other objects have &#8220;strong&#8221; references to the listener, the system will automatically remove such WeakReferences and free up the objects.</p>
<p>In part two and three of this series, we’ll discuss how to detect a leak and identifying the root cause, respectively. Stay tuned!!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/236/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=236&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2009/10/how-to-find-that-memory-leak-part-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/832dccdac0a9f32971905af91e11034e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamenv1</media:title>
		</media:content>
	</item>
		<item>
		<title>How-to Set up a Lightning Fast BlackBerry Smartphone Simulator</title>
		<link>http://devblog.blackberry.com/2009/08/how-to-set-up-a-lightning-fast-blackberry-smartphone-simulator/</link>
		<comments>http://devblog.blackberry.com/2009/08/how-to-set-up-a-lightning-fast-blackberry-smartphone-simulator/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 12:54:22 +0000</pubDate>
		<dc:creator>Kamen V.</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Java Development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JDE]]></category>
		<category><![CDATA[simulator]]></category>

		<guid isPermaLink="false">http://blackberrydev.edstaging.com/?p=625</guid>
		<description><![CDATA[Many times while coding an application for BlackBerry® smartphones, I want to quickly start the BlackBerry® Smartphone Simulator and see what I have achieved so far. Micro-iterative coding is my style of choice. I don&#8217;t need to debug any code, I just want to see it running; If it doesn’t work, then I’ll begin debugging. [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=625&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Many times while coding an application for BlackBerry® smartphones, I want to quickly start the BlackBerry® Smartphone Simulator and see what I have achieved so far. Micro-iterative coding is my style of choice. I don&#8217;t need to debug any code, I just want to see it running; If it doesn’t work, then I’ll begin debugging.  For those of you who share the same coding approach, here is a tip on how to make your BlackBerry Smartphone Simulator launch lightning fast.</p>
<h2>BlackBerry Smartphone Simulator Initial Launch</h2>
<p>The BlackBerry Smartphone Simulator keeps all simulated flash memory in .DMP files &#8211; you can find these in the simulator&#8217;s working directory. Whenever you need to get rid of any persistent data that you have accumulated, you can either delete these files manually or do it from within the <a title="BlackBerry JDE" href="http://supportforums.blackberry.com/t5/BlackBerry-Developer-s-Blog/BlackBerry-Java-Application-Development-v5-0-Beta-now-live/ba-p/315514#A73" target="_blank">BlackBerry® Java® Development Environment</a> (BlackBerry JDE) or the <a title="BlackBerry JDE Plug-in for Eclipse" href="http://na.blackberry.com/eng/developers/javaappdev/javaeclipseplug.jsp" target="_blank">BlackBerry® JDE Plug-in for Eclipse</a>. This acts as a grand reset giving you the equivalent of a brand new BlackBerry® smartphone. However, the next time the BlackBerry Smartphone Simulator launches it will need to load all the OS files (including any applications it finds in the current directory) and link them within the newly created file system. This obviously takes time – possibly up to 3 minutes. On the IBM® ThinkPad W500 I use at work it takes 32 seconds which is still a considerable wait time.<span id="more-625"></span></p>
<p><em><strong>So, rule number one</strong></em><strong>: delete the BlackBerry Smartphone Simulator file system only when necessary.</strong></p>
<p>There is also an option to automatically reset the file system every time you start the BlackBerry Smartphone Simulator &#8211; make sure it is also turned off unless you really need it.</p>
<ul>
<li>In the BlackBerry JDE, you can find it by selecting Edit -&gt; Preferences -&gt; Simulator -&gt; Memory and unchecking the “reset file system on startup” option.</li>
<li>In the BlackBerry JDE Plug-in for Eclipse, select Debug -&gt; Run Configuration and uncheck the option under the Memory tab.</li>
</ul>
<p style="text-align:center;"><img class="aligncenter size-full wp-image-911" title="Debug" src="http://rimdevblog.files.wordpress.com/2009/08/blackberry-jde-debug1.jpg?w=480&#038;h=338" alt="" width="480" height="338" /></p>
<h2>Debug Sessions</h2>
<p>The debug session is a connection established between the BlackBerry JDE and the BlackBerry Smartphone Simulator to enable… well, debugging. Establishing a debugging session requires many prerequisites to be prepared both on the BlackBerry Smartphone Simulator side and on the debugging tool side. When the debugging session is established on my laptop it takes 32 seconds for initial launch and 16 seconds for subsequent runs.  <strong>Without debugging it takes 23 seconds for initial launch and 10 seconds for subsequent launches! </strong></p>
<p style="text-align:center;"><img class="aligncenter size-full wp-image-912" title="Debug chart" src="http://rimdevblog.files.wordpress.com/2009/08/blackberry-debug-chart1.jpg?w=480&#038;h=270" alt="" width="480" height="270" /></p>
<p><strong><strong><em>Rule number two</em>: establish a debug session only when you have a specific problem to debug.</strong></strong></p>
<p>Don&#8217;t worry – if you run the application and find a problem, you can still attach the debugger:</p>
<ul>
<li>In the BlackBerry JDE, select Debug -&gt; Attach To -&gt; Simulator or press Ctrl-Shift-0.</li>
<li>In the BlackBerry JDE Plug-in for Eclipse, choose &#8220;Running BlackBerry Simulator&#8221; as your Debug Configuration.</li>
</ul>
<p style="text-align:center;"><img class="aligncenter size-full wp-image-913" title="How to debug" src="http://rimdevblog.files.wordpress.com/2009/08/blackberry-jde-debug-howto1.jpg?w=480&#038;h=185" alt="" width="480" height="185" /></p>
<h2>How to run the BlackBerry Smartphone Simulator without Debugging</h2>
<p>Now that it is apparent how much time we can save, let&#8217;s see what we need to do in order to avoid establishing a debug session. With the BlackBerry JDE Plug-in for Eclipse it&#8217;s pretty straightforward &#8211; simply select &#8220;Run&#8221; instead of &#8220;Debug&#8221; or use the CTRL-F11 shortcut and the BlackBerry Smartphone Simulator will launch right away. Using the BlackBerry JDE requires the slightly more involved process of creating a batch file:</p>
<ul>
<li>Open the BlackBerry Smartphone Simulator Properties menu and select Edit -&gt; Preferences -&gt; Simulator and then select the Advanced tab.</li>
<li>Here you have the actual command line that can launch the BlackBerry Smartphone Simulator with all the necessary command line options; every time you change an option under the Simulator tab it is reflected in this command line. You also have the proper working directory where the BlackBerry Smartphone Simulator should start in order to pick up any compiled applications.</li>
</ul>
<p style="text-align:center;"><img class="aligncenter size-full wp-image-914" title="BlackBerry® Smartphone Simulator" src="http://rimdevblog.files.wordpress.com/2009/08/blackberry-smartphone-simulator1.jpg?w=480&#038;h=454" alt="" width="480" height="454" /></p>
<ul>
<li>Now you can create your runBBSim.bat:</li>
</ul>
<p><code>pushd "[workingDirectory]"</code></p>
<p><code>"[cmdLine]"</code></p>
<p><code> </code></p>
<p><code>popd </code></p>
<ul>
<li>Now replace [workingDirectory] and [cmdLine] with the contents of the corresponding fields on the Advanced subtab of the BlackBerry Smartphone Simulator preferences: Command Line and Working Directory. Don&#8217;t forget to put quotes around any paths containing spaces to make the Windows command-prompt happy.</li>
</ul>
<p>Here is what my batch file looks like:</p>
<p><code>pushd "C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\bin\..\simulator"</code></p>
<p><code> </code></p>
<p><code>"C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\bin\..\simulator\fledge.exe" /app=Jvm.dll /session=9500 /app-param=DisableRegistration /app-param=JvmAlxConfigFile:9500.xml /data-port=0x4d44 /data-port=0x4d4e /pin=0x2100000A /handheld=9500</code></p>
<p><code> </code></p>
<p><code>popd</code></p>
<p>Now you can compile the application in the BlackBerry JDE, start the batch file, and in 10 seconds you will have a running BlackBerry Smartphone Simulator with your application installed on it! Sounds like too much trouble? Believe me it&#8217;s worth the effort!</p>
<p>Do you have any other tricks for speeding up the BlackBerry Smartphone Simulator? Let us know by posting a comment.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rimdevblog.wordpress.com/625/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rimdevblog.wordpress.com/625/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devblog.blackberry.com&#038;blog=17235680&#038;post=625&#038;subd=rimdevblog&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devblog.blackberry.com/2009/08/how-to-set-up-a-lightning-fast-blackberry-smartphone-simulator/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/832dccdac0a9f32971905af91e11034e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kamenv1</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2009/08/blackberry-jde-debug1.jpg" medium="image">
			<media:title type="html">Debug</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2009/08/blackberry-debug-chart1.jpg" medium="image">
			<media:title type="html">Debug chart</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2009/08/blackberry-jde-debug-howto1.jpg" medium="image">
			<media:title type="html">How to debug</media:title>
		</media:content>

		<media:content url="http://rimdevblog.files.wordpress.com/2009/08/blackberry-smartphone-simulator1.jpg" medium="image">
			<media:title type="html">BlackBerry® Smartphone Simulator</media:title>
		</media:content>
	</item>
	</channel>
</rss>
