Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Memory Leak ???

Memory Leak ???

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionperformancehelpcareer
2 Posts 2 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi I have some problem when run this program (press F5) when I click Run button then close program in suddenly. When return to VC++ it tells Detect Memory leak !!! and dump object ... I don't understand how it occur ??? and What is it ??? My program want Stop button that terminate running job not terminate program. Thanks bool stop; void CPumpMessageView::OnRun() // clicked Run Button { stop=false; for(int i=0; i<100; i++) { PumpMessage(); if(stop) break; else Sleep(250); } } void CPumpMessageView::PumpMessage() { MSG msg ; while (PeekMessage (&msg, 0, 0, 0, PM_NOREMOVE)) { if (!(AfxGetApp()->PumpMessage())) { // regenerate WM_QUIT for main message loop. ::PostQuitMessage(0); break; } } // let MFC do its idle processing LONG lIdle = 0; while (AfxGetApp()->OnIdle(lIdle++)); } void CPumpMessageView::OnStop() // clicked Stop Button { stop=true; }

    J 1 Reply Last reply
    0
    • L Lost User

      Hi I have some problem when run this program (press F5) when I click Run button then close program in suddenly. When return to VC++ it tells Detect Memory leak !!! and dump object ... I don't understand how it occur ??? and What is it ??? My program want Stop button that terminate running job not terminate program. Thanks bool stop; void CPumpMessageView::OnRun() // clicked Run Button { stop=false; for(int i=0; i<100; i++) { PumpMessage(); if(stop) break; else Sleep(250); } } void CPumpMessageView::PumpMessage() { MSG msg ; while (PeekMessage (&msg, 0, 0, 0, PM_NOREMOVE)) { if (!(AfxGetApp()->PumpMessage())) { // regenerate WM_QUIT for main message loop. ::PostQuitMessage(0); break; } } // let MFC do its idle processing LONG lIdle = 0; while (AfxGetApp()->OnIdle(lIdle++)); } void CPumpMessageView::OnStop() // clicked Stop Button { stop=true; }

      J Offline
      J Offline
      John M Drescher
      wrote on last edited by
      #2

      The problem does not seem to be with this code. If you dynamically created an object of type CPumpMessageView make sure you destroy the object before the application object terminates. If this is not your problem please post the object dump so that I can better understand the problem.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups