in Education by
I am inputting a 200mb file in my application and due to a very strange reason the memory usage of my application is more than 600mb. I have tried vector and deque, as well as std::string and char * with no avail. I need the memory usage of my application to be almost the same as the file I am reading, any suggestions would be extremely helpful. Is there a bug that causes so much memory consumption? Could you pinpoint the problem or should I rewrite the whole thing? Windows Vista SP1 x64, Microsoft Visual Studio 2008 SP1, 32Bit Release Version, Intel CPU The whole application until now: #include #include #include #include #include #include #include #include #include

1 Answer

0 votes
by
Your memory is being fragmented. Try something like this : HANDLE heaps[1025]; DWORD nheaps = GetProcessHeaps((sizeof(heaps) / sizeof(HANDLE)) - 1, heaps); for (DWORD i = 0; i < nheaps; ++i) { ULONG HeapFragValue = 2; HeapSetInformation(heaps[i], HeapCompatibilityInformation, &HeapFragValue, sizeof(HeapFragValue)); }

Related questions

0 votes
    I am inputting a 200mb file in my application and due to a very strange reason the memory usage of ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    I am working on a very large scale computing library that is using STL heavily. The library is being ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    I had a program working good (without prompting errors) using references, but I decided to use a pointer-to-pointer array ... that it is there because I have put two flags (cout...
asked Apr 6, 2022 in Education by JackTerrance
0 votes
    Take the following code snippet: #include std::vector good; //illegal, because std::allocator is ill-formed ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I am implementing a display algorithm where we can have multiple layers of windows based on their z-order i ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    I am implementing a display algorithm where we can have multiple layers of windows based on their z-order i ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    I am implementing a display algorithm where we can have multiple layers of windows based on their z-order i ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    What features of C++ should be avoided in embedded systems? Please classify the answer by reason such as: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 20, 2022 in Education by JackTerrance
0 votes
    I'd like to ensure my RAII class is always allocated on the stack. How do I prevent a class from ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I'd like to ensure my RAII class is always allocated on the stack. How do I prevent a class from ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    i think my buddies have forgotten me?? ◑﹏◐ ಥ_ಥ if u are f r e e then l i k e my answer #what is full form of html Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    I have created a client-server program with Perl using IO::Socket::INET. I access server through CGI ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    I would like to use CHOLMOD's GPU acceleration, and have found several simple examples on how to use ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
...