Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I allocate all the availble memory in visual studio for my application?
    text
    copied!<p>I want to render 4 millions triangles in my windows based software which is written in Visual Studio C++ 2010 (Build in Release Mode). When I render 3.9 millions triangles, the total RAM memory consumed by the software is 400MB. But when I try to render 4 millions triangles (just 100K more), the system gives me an error. </p> <pre><code>For Example: Point *P = new (std::nothrow) Point[nb_triangles]; //==&gt; "(std::nothrow)" is for catching the run time memory allocation error. (Point is X, Y, Z floats) If(P == NULL) message("System can't allocate this much memory."); // System gives me this error. It means the system can't reserve huge memory for this operation. </code></pre> <p>I have to allocate memory for vertices, face normals, vertex normals, etc. </p> <p>Actually what I am not getting is, I have 8 GB RAM memory, (but in 32 bit XP windows = 3.2GB memory), and the software is just reserved 400MB, the free memory is more than 1 GB, but when I try to render just 100K triangles more, it gives me an error. Why it is giving me an error? because it still has more than 1 GB free RAM memory?</p> <p>Is there anyway to fix this issue, how can I allocate all the available memory for my application ? Because of this issue, I have to make a limit in the software just for rendering 3.9 millions triangles and it is not good.</p> <p>And one more question in my mind is, c++ "new" operator for memory allocation giving me error, how about c "malloc" operator ? can "malloc" fix this issue, is there any diffirence between these two?</p> <p>Please guide me. Thanks.</p> <p><strong>Update # 1:</strong> </p> <p>I have tried a lot, modify the code, remove memory leaks, etc, but I can not allocate memory more than 4 millions. Its not possible to change my whole code into "vector". I can't change into "vector", I have to stuck on my own data structure now with "new". Following are the pointers that I want to allocate in order to render 1 object. </p> <pre><code>P = new points[10000000]; // points is the class with 3 floats X, Y, Z; N = new Norm[10000000]; // Norm is the class with 3 floats X, Y, Z; V = new vNorm[10000000]; // vNorm is the class with 3 floats X, Y, Z; T = new Tri[10000000]; // Tri is the class with 3 integers v1, v2, v3; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload