title: When do I need to free a Data Module created by the Application?
body: <p>i have the code as follows:  </p>
  
  <pre><code>begin
    Application.Initialize;
    Application.Title := 'Controle Bancário';
    Application.CreateForm(T_DMEstagio, _DMEstagio);
    Application.CreateForm(T_frmLogin, _frmLogin);
    if (_frmLogin.ShowModal = 1) then
      begin
        FreeAndNil(_frmLogin);
        Application.CreateForm(T_frmPrincipal, _frmPrincipal);
        Application.Run;
      end;
      _DMEstagio.Free;
  
  end.
  </code></pre>
  
  <p>If I DONT explicitly free the DM as I did in the code, I get an Access Violation Exception, but in another application that the code is like this:  </p>
  
  <pre><code>begin
      Application.Initialize;
      Application.Title := ' &gt; Sistema de Gestão Comercial &lt;';
      if HPrevInst = 0 then
      begin
        Application.CreateForm(TFrmPrincipal, FrmPrincipal);
        Application.CreateForm(TIBDM, IBDM);
        Application.Run;
      end ;
  end.
  </code></pre>
  
  <p>I dont have to free the DM and i dont get any exception. Why is that?</p>