MEMORY ALLOCATION

  • Thread starter =?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=
  • Start date
?

=?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=

Hi all,

I built a softwaare (4 finite elements) and now that i solved all
maths troubles i'm trying to expand some informatic skills.
I call EXE file from cmd (under XP) and i made bad discoveries like
that string for argvector must be not more than 127 chars long...
I solved all except 1 thing:
I'm using Borland TC with compact size for stack dimension (with bigger
sizes EXES raise windows ferocity) and I mallocated dynamic vectors in
usual way...
but is that possible that i can't reach 7*400*sizeof(float)=11200 bytes
I presume without getting memory overflow or application frozen?????
And why i can't succed in writing
int _stklen = desidered dimension;???
Anyone had the same problem under XP?
How to allocate big memory blocks? My program is at least 300 times
faster than Matlab solvers....but as long as i can't work on big
instances this computational power gets useless

Thanks in advance
 
T

Tom St Denis

Poincarè_è_andato said:

Hi, does asking the question with two subject lines make it more
important?
I'm using Borland TC with compact size for stack dimension (with bigger
sizes EXES raise windows ferocity) and I mallocated dynamic vectors in
usual way...

"compact size" ??? what's that?
but is that possible that i can't reach 7*400*sizeof(float)=11200 bytes

Definitely not too large.
I presume without getting memory overflow or application frozen?????

We can guess too. Without code it's about all we can do.
And why i can't succed in writing
int _stklen = desidered dimension;???

What is stklen?
Anyone had the same problem under XP?

Don't use a 20 year old 16-bit C compiler ...
How to allocate big memory blocks? My program is at least 300 times
faster than Matlab solvers....but as long as i can't work on big
instances this computational power gets useless

Use a modern C compiler meant for a 32-bit os like XP.

Tom
 
?

=?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=

Tom said:
Hi, does asking the question with two subject lines make it more
important?


"compact size" ??? what's that?


Definitely not too large.


We can guess too. Without code it's about all we can do.


What is stklen?


Don't use a 20 year old 16-bit C compiler ...


Use a modern C compiler meant for a 32-bit os like XP.

Tom

Hi Tom... u had this problem and solved compiling with 32 bit?
Hey u r right, i'm 21 y old.... I hope your aim was to help
 
J

Jack Klein

Hi all,

I built a softwaare (4 finite elements) and now that i solved all
maths troubles i'm trying to expand some informatic skills.
I call EXE file from cmd (under XP) and i made bad discoveries like
that string for argvector must be not more than 127 chars long...
I solved all except 1 thing:
I'm using Borland TC with compact size for stack dimension (with bigger
sizes EXES raise windows ferocity) and I mallocated dynamic vectors in
usual way...
but is that possible that i can't reach 7*400*sizeof(float)=11200 bytes
I presume without getting memory overflow or application frozen?????
And why i can't succed in writing
int _stklen = desidered dimension;???
Anyone had the same problem under XP?
How to allocate big memory blocks? My program is at least 300 times
faster than Matlab solvers....but as long as i can't work on big
instances this computational power gets useless

Thanks in advance

1. Don't post the same question twice with two different titles, one
minute apart.

2. See my reply to your first post.
 
T

Tom St Denis

Poincarè_è_andato said:
Hi Tom... u had this problem and solved compiling with 32 bit?

Can't say because I can't see the code.

But if your problem is that you're running out of memory, chances are
moving from a 16-bit platform with 64KB of memory space to a 32-bit
platform with typically ~2GB of memory space will help.
Hey u r right, i'm 21 y old.... I hope your aim was to help

So what, I'm 24. Doesn't mean you can't google the net for free C
compilers and move on to something more appropriate.

Tom
 
?

=?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=

Sorry 4 double posting but i realized too late i missed subject....

Here 's the code

#include <math.h>
#include <ce.c>
#include <stdio.h>
#include <stdlib.h>
#include <alloc.h>

const len_max=1000;
const t_max=100100000;
/*float g[len_max];*/
int len=len_max;

extern unsigned _stklen=50000;

float* g;
float* d_A;
float* d_up_A;
float* d_down_A;
float* d_M;
float* d_up_M;
float* d_down_M;


void main(int argc,char *argv[])
{

g=(float*)malloc(len*sizeof(float));
d_A=(float*)malloc(len*sizeof(float));
d_up_A=(float*)malloc(len*sizeof(float));
d_down_A=(float*)malloc(len*sizeof(float));
d_M=(float*)malloc(len*sizeof(float));
d_up_M=(float*)malloc(len*sizeof(float));
d_down_M=(float*)malloc(len*sizeof(float));

.....


free(g);
free(d_A);
free(d_up_A);
free(d_down_A);
free(d_M);
free(d_up_M);
free(d_down_M);
}
 
I

Ian Collins

Poincarè_è_andato said:
Sorry 4 double posting but i realized too late i missed subject....
Please provide some context and avoid silly abbreviations like 4 and u.
Here 's the code
What's the question?
#include <math.h>
#include <ce.c>
Eh?

#include <stdio.h>
#include <stdlib.h>
#include <alloc.h>
Non-standard and not required by the code.
const len_max=1000;
const t_max=100100000;

Don't use implicit int.
/*float g[len_max];*/
int len=len_max;
Why is this a global? You can't initialise a global with something that
isn't a compile time constant, which (for historical reasons) doesn't
include const ints.
extern unsigned _stklen=50000;
From your original question, this is too big for a 16 bit int.
float* g;
float* d_A;
float* d_up_A;
float* d_down_A;
float* d_M;
float* d_up_M;
float* d_down_M;
Why are these globals?

void main(int argc,char *argv[])
{

g=(float*)malloc(len*sizeof(float));

Don't cast the return value of malloc.

What is code for? Once the non-standard headers and the unnecessary
globals are fixed, it compiles and runs fine.
 
?

=?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=

Hi Ian
It's a Galerkin 1st order continous with Lax-Wendroff time
discretization code.
The code works compiled on 16 bit.
But 4 big instances i get windows memory errors or app frozen.
 
I

Ian Collins

Poincarè_è_andato wrote:

Where's the context?
Hi Ian
It's a Galerkin 1st order continous with Lax-Wendroff time
discretization code.
The code works compiled on 16 bit.
But 4 big instances i get windows memory errors or app frozen.
Which 4?

These errors have been explained: don't use antique compilers on
contemporary platforms.
 
?

=?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=

I'm trying to compile with a 32 compiler,
I made a GUI in QT with VS but i couldn't compile this code over there
because of too many errors for libraries or commands not supported.
That 's why i'm still trying to compile with TC,
Now i just tried with bcc55 getting enough errors...
I will accept small instance instead of looking for errors in 3
thousand lines code
 
I

Ian Collins

Poincarè_è_andato wrote:

Getting better, context but please don't top post.
I'm trying to compile with a 32 compiler,
I made a GUI in QT with VS but i couldn't compile this code over there
because of too many errors for libraries or commands not supported.
That 's why i'm still trying to compile with TC,
Now i just tried with bcc55 getting enough errors...
I will accept small instance instead of looking for errors in 3
thousand lines code
I'm not sure what you are asking, to get help with specific errors, post
a self contained code snippet that gives the error.
 
C

CBFalconer

Poincarè_è_andato said:
.... snip ...

Hi Tom... u had this problem and solved compiling with 32 bit?
Hey u r right, i'm 21 y old.... I hope your aim was to help

Writing in baby talk will not get you any help here.
 
?

=?iso-8859-1?B?UG9pbmNhcuhf6F9hbmRhdG8=?=

Hi Ian,
the errors that compiler gave was due to not supported C costructions
,
I found many of the above objections moved to my code that gave error
compiling in c++,
like casting , type constants or global declarations.
Whatever now, after 1 hard night all works fine: i can discretize time
in Teras and space in
kilos, allocating "unlimited" space (cos i'm still growing in allocate
dimension and still i don't get any errors)

Thanks a lot for helping me, sure you forgive my newbie attitude
 
S

santosh

Poincarè_è_andato wrote:
Hi Ian,
the errors that compiler gave was due to not supported C costructions
,
I found many of the above objections moved to my code that gave error
compiling in c++,
like casting , type constants or global declarations.
Whatever now, after 1 hard night all works fine: i can discretize time
in Teras and space in
kilos, allocating "unlimited" space (cos i'm still growing in allocate
dimension and still i don't get any errors)

Thanks a lot for helping me, sure you forgive my newbie attitude

For the second time, *don't* top-post. If you're not sure what we mean,
please read through the information given at the following URLs:

(Taken from one of CBFalconer's sigs)
Some informative links:
< <http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top