Thread: Memory issue...

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    Memory issue...

    Hello. I am working on a browser. After parsing the web-page, I will be creating a class Graphic node and attaching it to the first and so on. After the user hops to another page, I will be freeing the memory of the class Graphic linked list objects, and renew the process. My question is, is this a bad idea? Would an array of Graphic objects be better since each element is reused, or will Windows be properly reclaiming the memory deallocated from the linked list version?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I don't think anyone here really knows whether or not windows reallocations and redistributes memory well or not. I think we all assume that it does. And that assumption has taken many of us far You should do it dynamically since static allocation has limitations to the static heap. If you make an large heap to overcome limitations you create a large memory hog that didn't need to be there in the first place. You want to avoid memory waste more than anything else.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    As long as you free any memory you've allocated, and any GDI objects you've created, Windows will free up the memory. Do not, however, expect to see the memory usage figure change smoothly, i.e. allocating a 100 bytes may or may not increase your tasks memory allocation, similaly, freeing some memory may not change the allocation.

    The memory manager allocates and deallocates memory in largeish chunks, and does so as required by the system rather than the vagaries of the program.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Thanks, guys!
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help finding potential Memory issue
    By JoshNCSU22 in forum C Programming
    Replies: 9
    Last Post: 10-29-2008, 09:58 AM
  2. What's the difference?
    By Stonehambey in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 10:26 AM
  3. threads and memory issue
    By Anubhav in forum C Programming
    Replies: 6
    Last Post: 07-25-2006, 04:51 AM
  4. Memory Leak Help
    By (TNT) in forum Windows Programming
    Replies: 3
    Last Post: 06-19-2006, 11:22 AM
  5. Accessing Video Memory Information...need help
    By KneeLess in forum C++ Programming
    Replies: 8
    Last Post: 08-24-2003, 03:53 PM