Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    Mumbai - India

    Little confusion about cleanup stack(CS)

    What's CS :

    Used to put pointers of automatic/local pointers on stack. So that if, App closes without clearing memory. OS will clear that memory.

    It does not call destructor as it's called by OS after app closed. Hence pushing a class object having pointers is useless.

    Why not I push objects other then automatic ? It will be much more safer.


  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    it is safe. Basically objects also needs to be derived from CBase, so their destructor will be called.

    Basically the cleanup stack, just calls the cleanup object made form the class, and if the calss is derived from CBase it will call its destructor. And if not the cleanup will be simple free operation.

    So in case your classes are experiencing problems, check the derivation thing, and if you can not use CBase as a base for your class, make your own cleanup object for it, so the cleanup stack will work correctly.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts