problem with "setlength"
Page 1 of 1

Author:  Ashandorath [ Wed Jun 22, 2011 4:18 pm ]
Post subject:  problem with "setlength"

edit: problem seems to have been fixed. I was probably trying allocate more memory than I had on accident. This failed for obvious reason.

description below.

the code:

laplaceArray.setlength(mesh_.n_vertices(), mesh_.n_vertices());
alglib::real_2d_array areas;
areas.setlength(mesh_.n_vertices(), mesh_.n_vertices()); //this is the line that causes the error
alglib::real_2d_array weights;
weights.setlength(mesh_.n_vertices(), mesh_.n_vertices());

error Message:

Unhandled Exception: System.Runtime.InteropServices.SEHException: External compo
nent has thrown an exception.
at _CxxThrowException(Void* , _s__ThrowInfo* )
at alglib.ae_matrix_wrapper.setlength(ae_matrix_wrapper* , Int32 rows, Int32
cols) in c:\users\nicholas\geometric modelling\project\exercise2\exercise2\src\c
ourseexamples\02-diffgeom\ap.cpp:line 4670
at HeatKernelMain.buildLaplaceMatrix(HeatKernelMain* ) in c:\users\nicholas\g
eometric modelling\project\exercise2\exercise2\src\courseexamples\02-diffgeom\he
atkernelmain.cpp:line 305
at HeatKernelMain.run_example(HeatKernelMain* ) in c:\users\nicholas\geometri
c modelling\project\exercise2\exercise2\src\courseexamples\02-diffgeom\heatkerne
lmain.cpp:line 128
at HeatKernelMain.open_mesh(HeatKernelMain* , SByte* _filename) in c:\users\n
icholas\geometric modelling\project\exercise2\exercise2\src\courseexamples\02-di
ffgeom\heatkernelmain.cpp:line 152
at main(Int32 argc, SByte** argv) in c:\users\nicholas\geometric modelling\pr
oject\exercise2\exercise2\src\courseexamples\02-diffgeom\ 43

at _mainCRTStartup()

The problem is a bit odd. If I comment out the line "laplaceArray.setlength(mesh_.n_vertices(), mesh_.n_vertices());", it doesn't crash at "areas.setlength(mesh_.n_vertices(), mesh_.n_vertices());" anymore, but at "weights.setlength(mesh_.n_vertices(), mesh_.n_vertices());"

the size of the matrix is currently about 34800*34800 (just checked: is this by any chance 5 gigabytes? that would explain the problem (only have 4 gigabytes of ram -.-)

edit: i'm using microsoft visual studio 2010 express.

edit2: the lines from ap.cpp
if( !ae_matrix_set_length(p_mat, rows, cols, NULL) )
throw alglib::ap_error("ALGLIB: malloc error"); <- error being thrown.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group