Results 1 to 17 of 17

Thread: QHash : Virtual memory not released

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: QHash : Virtual memory not released

    Quote Originally Posted by wysota View Post
    It will be freed immediately (it's C++, not Java, after all). It will just not be unassigned from the process in case it wants to allocate it again.
    Maybe I'm showing my age now and things are not done as they used to be done before, but I'm used to the fact that you free() or delete some memory and the memory is returned to the heap for the process, and not to the system. Only when the amout of free memory hit a predefined figure was the memory actually freed to the system, to prevent memory fragmentation. This was when the C compiler ran from a floppy disk however

    jbenoit: "eventually" will not stop you from allocating further memory. The reserved memory will be used before more is requested from the system. I doesn't hold on to memory knowing you want it for something else.

    As for vacuum processes, all you have to do is a loop allocating 100KB at a time until malloc() returns NULL. At that point you have allocated all that is possible from a single process (which depends on page file size, OS, 32/64bit etc). Or you can buy a product that does this for you for between $20 and $99 or so. It'll come with a flashy GUI and lots of flashing lights, but behind the scenes, it does exactly the same as you can do in 5 minutes by writing it yourself.

    Defragmenting virtual memory is a nonsense idea anyway, even if you have a 4GB contiguous chunk of memory, theres nothing stopping the OS mapping those contiguous chunks to a random chunks of physical memory. The only way of getting a chunk of contiguous physical memory is by dropping to the device driver ring (ring 0) and requesting it there.
    Last edited by squidge; 13th November 2009 at 18:10.

Similar Threads

  1. Virtual memory allocation problem
    By morfei in forum Qt Programming
    Replies: 1
    Last Post: 27th August 2009, 11:30
  2. free up the memory used by QHash
    By vishal.chauhan in forum Qt Programming
    Replies: 8
    Last Post: 22nd June 2009, 19:13
  3. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 17:50
  4. Virtual memory problem
    By Rahul in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2007, 13:29
  5. Virtual Memory in Qt 4.2.2
    By Shuchi Agrawal in forum Newbie
    Replies: 3
    Last Post: 5th March 2007, 23:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.