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

Thread: Store some variables in disk

  1. #1
    Join Date
    Nov 2010
    Posts
    47

    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
    5,957

    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
    3,827

    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
    Posts
    12,067

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center