CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2010
    Posts
    54

    Store some variables in disk

    Hi,

    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?

    Thanks

    Alan

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Store some variables in disk

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

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    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
    Location
    Florida
    Posts
    12,635

    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
  •  





Click Here to Expand Forum to Full Width

Featured