Store some variables in disk
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 4 of 4

Thread: Store some variables in disk

  1. #1
    Join Date
    Nov 2010

    Store some variables in disk


    I am using Visual C++ to write an app. One problem is that the application will allocate a lot of object instances of a specific class CMyObject, maybe 400, 000. This will cause “Out of memory” error when total allocated CMyObject reaches 400,000.

    To solve this problem, I just wonder when a new CMyObject instance is created, is it possible to specify so that the instance will allocate on a disk cache, or file mapping instead of the memory space?



  2. #2
    Join Date
    Nov 2000
    Voronezh, Russia

    Re: Store some variables in disk

    Most probably the need in allocating a half million objects indicates bad design issue.
    Best regards,

  3. #3
    Join Date
    Apr 2000
    Belgium (Europe)

    Re: Store some variables in disk

    What igor said.

    Regardless of bad design issues
    If you are exhausting the address space of your application (for a Win32 app this is 2Gb, possibly 3gb with a switch in the build settings and depending on which version of windows) then you will need to do any disk based management yourself.

    Compiling as a Win64 app might work, though it's still probably bad design to have that many objects.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003

    Re: Store some variables in disk

    Hard to say without knowing what you're doing, but perhaps you need a database.

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This a survey!

HTML5 Development Center