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. Urgent!! Please Help

Urgent!! Please Help

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
24 Posts 8 Posters 0 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.
  • D dheka

    No Sir!!! Iam not Creating Objects Dynamically.. and remaining resources iam properly deallocating.. So tell me should i create Dialog Object Dynamically so that i can delete memory explicitly... iam creating new dialog like this,, CMyDialog ss; ss.Domodal(); and further iam not doing any thing for memory deallocation. So how i can deallocate meomory for Statically created objects ..

    M Offline
    M Offline
    Maxwell Chen
    wrote on last edited by
    #9

    Sounds like the other cause ...

    Maxwell Chen

    D 1 Reply Last reply
    0
    • M Maxwell Chen

      Sounds like the other cause ...

      Maxwell Chen

      D Offline
      D Offline
      dheka
      wrote on last edited by
      #10

      Sir Can i use Smart Pointer for proper releasing of resource like memory..

      M C 2 Replies Last reply
      0
      • D dheka

        Sir Can i use Smart Pointer for proper releasing of resource like memory..

        M Offline
        M Offline
        Maxwell Chen
        wrote on last edited by
        #11

        dheka wrote:

        Sir Can i use Smart Pointer for proper releasing of resource like memory..

        Yes of course. But remember that smart pointers can also fall into unsmart under some specific conditions. Your situation may not necessarily be the resource free issue. I suggest you to profile the performance of your code (function level). In other words, to benchmark how long it takes for each major function implementations to execute.

        Maxwell Chen

        D 1 Reply Last reply
        0
        • M Maxwell Chen

          dheka wrote:

          Sir Can i use Smart Pointer for proper releasing of resource like memory..

          Yes of course. But remember that smart pointers can also fall into unsmart under some specific conditions. Your situation may not necessarily be the resource free issue. I suggest you to profile the performance of your code (function level). In other words, to benchmark how long it takes for each major function implementations to execute.

          Maxwell Chen

          D Offline
          D Offline
          dheka
          wrote on last edited by
          #12

          Ok Sir..Thanks for ur Kind replys..

          D 1 Reply Last reply
          0
          • D dheka

            Sir Can i use Smart Pointer for proper releasing of resource like memory..

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #13

            No, you probably need a good Windows programming tutorial. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

            1 Reply Last reply
            0
            • D dheka

              No Sir!!! Iam not Creating Objects Dynamically.. and remaining resources iam properly deallocating.. So tell me should i create Dialog Object Dynamically so that i can delete memory explicitly... iam creating new dialog like this,, CMyDialog ss; ss.Domodal(); and further iam not doing any thing for memory deallocation. So how i can deallocate meomory for Statically created objects ..

              R Offline
              R Offline
              Rajkumar R
              wrote on last edited by
              #14

              dheka wrote:

              iam creating new dialog like this,, CMyDialog ss; ss.Domodal();

              Since your application is dialog based application, you are creating DoModal() to show up a dialog. showing up the dialog, are you creating new dialog, and so on. Is the dialog is getting stacked one on the other. When you are creating the dialog?

              D 1 Reply Last reply
              0
              • R Rajkumar R

                dheka wrote:

                iam creating new dialog like this,, CMyDialog ss; ss.Domodal();

                Since your application is dialog based application, you are creating DoModal() to show up a dialog. showing up the dialog, are you creating new dialog, and so on. Is the dialog is getting stacked one on the other. When you are creating the dialog?

                D Offline
                D Offline
                dheka
                wrote on last edited by
                #15

                Hi..No Iam Ending the dialog using EndDialog() Function. After Ending Dialog I dont know whether it still using memory or not. Can u tel me proper killing a Dialog after particular interval or event!! Plz..

                M R 2 Replies Last reply
                0
                • D dheka

                  Hi..No Iam Ending the dialog using EndDialog() Function. After Ending Dialog I dont know whether it still using memory or not. Can u tel me proper killing a Dialog after particular interval or event!! Plz..

                  M Offline
                  M Offline
                  Maxwell Chen
                  wrote on last edited by
                  #16

                  dheka wrote:

                  Iam Ending the dialog using EndDialog() Function.

                  Since you are using CDialog::DoModal, you should end the dialog with CDialog::OnClose.

                  Maxwell Chen

                  R 1 Reply Last reply
                  0
                  • D dheka

                    Iam a Jr. VC++ Developer. Iam working on Dialog based application(MFC). My application is almost completed. It is typically a Billpayment sort of application. It works Fine for few Transactions but starts Slowing down and finally get hanged if i made several transaction of same flow.I have to restart my application again and so on. I cant find out the exact reasons of this. Iam created all my object statically. Is there any problem regarding statically or Dyanamically object creation. Please Tel me the reason, so that i get rid off soon.X|

                    M Offline
                    M Offline
                    Maximilien
                    wrote on last edited by
                    #17

                    Do you allocated data with new or malloc ? If so, Are you using delete or free to release the memory ? Are you communicating (transmitting) data somewhere ? on the network, in a Database ? in a file ? If you keep the data in memory, what happen when you add more and more data ? is it added in a "sorted" way ? (in debug mode) When you just do a couple of "transations", and quit, does the debugger report memory leaks ?

                    Maximilien Lincourt Your Head A Splode - Strong Bad

                    D 1 Reply Last reply
                    0
                    • D dheka

                      Ok Sir..Thanks for ur Kind replys..

                      D Offline
                      D Offline
                      Demian Panello
                      wrote on last edited by
                      #18

                      Use the Windows Task Manager to see if you are releasing properly the objects you've allocated. You will see the "Usage memory" column of your program will increase very quick instead of being stable. That will help you to find memory leaks that could cause your program decrease in performance until hang it.

                      Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

                      D 1 Reply Last reply
                      0
                      • M Maxwell Chen

                        dheka wrote:

                        Iam Ending the dialog using EndDialog() Function.

                        Since you are using CDialog::DoModal, you should end the dialog with CDialog::OnClose.

                        Maxwell Chen

                        R Offline
                        R Offline
                        Rajkumar R
                        wrote on last edited by
                        #19

                        HI Maxwell are you sure EndDialog() should not be used. please refer msdn for CDialog::EndDialog and implementation of CDialog::OnOK().

                        M 1 Reply Last reply
                        0
                        • D dheka

                          Hi..No Iam Ending the dialog using EndDialog() Function. After Ending Dialog I dont know whether it still using memory or not. Can u tel me proper killing a Dialog after particular interval or event!! Plz..

                          R Offline
                          R Offline
                          Rajkumar R
                          wrote on last edited by
                          #20

                          dheka wrote:

                          After Ending Dialog I dont know whether it still using memory or not

                          the class instance gets released after EndDialog and the local dialog variable. What about the resources used by the dialog class? You may have written code to release it. But are you sure the cleanup code gets executed? Debug the code, if it hangs, debugger shows the waiting statement if you pause the running application in the debugger. And you are doing some billpayment process, are handling connection to database correctly?

                          1 Reply Last reply
                          0
                          • R Rajkumar R

                            HI Maxwell are you sure EndDialog() should not be used. please refer msdn for CDialog::EndDialog and implementation of CDialog::OnOK().

                            M Offline
                            M Offline
                            Maxwell Chen
                            wrote on last edited by
                            #21

                            Rajkumar R wrote:

                            are you sure EndDialog() should not be used. please refer msdn for CDialog::EndDialog and implementation of CDialog::OnOK().

                            You are right! It was my mistake. :-D

                            Maxwell Chen

                            1 Reply Last reply
                            0
                            • D dheka

                              Iam a Jr. VC++ Developer. Iam working on Dialog based application(MFC). My application is almost completed. It is typically a Billpayment sort of application. It works Fine for few Transactions but starts Slowing down and finally get hanged if i made several transaction of same flow.I have to restart my application again and so on. I cant find out the exact reasons of this. Iam created all my object statically. Is there any problem regarding statically or Dyanamically object creation. Please Tel me the reason, so that i get rid off soon.X|

                              K Offline
                              K Offline
                              kanduripavan
                              wrote on last edited by
                              #22

                              I have few things to say. Check if you have any Memory profiler tools nearby available to you. Such as Rational purify or something else even one from codeproject. Run your code once. That will fix your problem. You will definitely get the location where u are going wrong. Have patience. I know its too hard, but its the truth.

                              1 Reply Last reply
                              0
                              • D Demian Panello

                                Use the Windows Task Manager to see if you are releasing properly the objects you've allocated. You will see the "Usage memory" column of your program will increase very quick instead of being stable. That will help you to find memory leaks that could cause your program decrease in performance until hang it.

                                Demian. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -Bjarne Stroustrup, computer science professor, designer of C++ programming language (1950- )

                                D Offline
                                D Offline
                                dheka
                                wrote on last edited by
                                #23

                                Ya Sir1!Iam Checking it out in Task MAnager.ya iam getting problem in my second Dialog box..After Pressing cancel button in it,iam Ending that dialog using CDialog::EndDialog() function, but memory usage get increased tremendiosly.. So iam trying to poiint it out...Thanks

                                1 Reply Last reply
                                0
                                • M Maximilien

                                  Do you allocated data with new or malloc ? If so, Are you using delete or free to release the memory ? Are you communicating (transmitting) data somewhere ? on the network, in a Database ? in a file ? If you keep the data in memory, what happen when you add more and more data ? is it added in a "sorted" way ? (in debug mode) When you just do a couple of "transations", and quit, does the debugger report memory leaks ?

                                  Maximilien Lincourt Your Head A Splode - Strong Bad

                                  D Offline
                                  D Offline
                                  dheka
                                  wrote on last edited by
                                  #24

                                  Hello Sir!! No sir iam not using malloc or new keywords to allocate memory..bt ya iam communicating with remote server and file also.

                                  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