title: memory-allocation breakpoint does not stop execution
body: <p>I have a piece of JNI code with a mem leak:</p>
  
  <pre><code>Detected memory leaks!
  Dumping objects -&gt;
  {76} normal block at 0x277522F8, 52 bytes long.
   Data: &lt; "u' "u' "u'    &gt; F8 22 75 27 F8 22 75 27 F8 22 75 27 CD CD CD CD
  Object dump complete.
  </code></pre>
  
  <p>So, I set a breakpoint ont the specified memory allocation number (76 in this case).</p>
  
  <pre><code>_crtBreakAlloc = 76;
  </code></pre>
  
  <p>But the application never stop execution like if that allocation was never performed.</p>
  
  <p>I also took two memory snapshots at the beginnning and at the end of the program, and I compared them.</p>
  
  <p>(At code beginning):    </p>
  
  <pre><code>_CrtMemCheckpoint( &amp;s1 );
  </code></pre>
  
  <p>(At code end):</p>
  
  <pre><code>_CrtMemCheckpoint( &amp;s2 );
  
  _CrtMemState s3;
  _CrtMemDifference( &amp;s3, &amp;s1, &amp;s2);
  _CrtMemDumpStatistics( &amp;s3 );
  </code></pre>
  
  <p>Here the result:</p>
  
  <pre><code>0 bytes in 0 Free Blocks.
  0 bytes in 0 Normal Blocks.
  0 bytes in 0 CRT Blocks.
  0 bytes in 0 Ignore Blocks.
  0 bytes in 0 Client Blocks.
  Largest number used: 2839 bytes.
  Total allocations: 101483 bytes.
  </code></pre>
  
  <p>It seems that all is OK.</p>
  
  <p>I can't figure out what is happening. Is it a false positive mem leak? Or is a memleak of the JVM? If so, is there a way to detect it?</p>
  
  <p><strong>Added after the solution was found:</strong></p>
  
  <p>I modified the initialization of a static <code>map</code> and the problem has been solved.
  In particular, I transformed a private static member from <code>map</code> to <code>map*</code>. The problem is that when you initialize a static, it must be initialized with a constant.
  Here is how I changed the declaration of the static member:</p>
  
  <pre><code>static const map&lt;wstring, enumValue&gt;* mapParamNames;
  </code></pre>
  
  <p>So my <code>initialize()</code> method becomes: </p>
  
  <pre><code>map&lt;wstring, paramNames&gt;* m = new map&lt;wstring, paramNames&gt;();
  (*m)[L"detectCaptions"] = detectCaptions;
  (*m)[L"insertEmptyParagraphsForBigInterlines"] = insertEmptyParagraphsForBigInterlines;
  (*m)[L"fastMode"] = fastMode;
  (*m)[L"predefinedTextLanguage"] = predefinedTextLanguage;
  (*m)[L"detectFontSize"] = detectFontSize;
  (*m)[L"saveCharacterRecognitionVariants"] = saveCharacterRecognitionVariants;
  (*m)[L"detectBold"] = detectBold;
  (*m)[L"saveWordRecognitionVariants"] = saveWordRecognitionVariants;
  
  KernelParamsSetter::mapParamNames = m;
  </code></pre>
  
  <p>Finally, I inserted the <code>delete</code> of the map in the class destructor:</p>
  
  <pre><code>delete KernelParamsSetter::mapParamNames;
  </code></pre>
  
  <p>Hope this can be useful for someone.</p>