A memory question

P

poison.summer

Hello it takes about 30M memory to run my program.
Can anyone give me some suggestions on why it costs so much memory?
Thanks a lot!
 
A

Artie Gold

Hello it takes about 30M memory to run my program.
Can anyone give me some suggestions on why it costs so much memory?
Thanks a lot!
It's obviously due to what you're doing on line 42.

[Seriously, though, how would *anyone* know -- or even hazard a
reasonable guess -- without some relevant information?]

HTH,
--ag
 
M

Michael Mair

Hello it takes about 30M memory to run my program.
Can anyone give me some suggestions on why it costs so much memory?

You are using that much.
You are wasting part of it.

Your request is definitely off-topic in comp.lang.c
For questions about algorithms and data structures, consider
asking in comp.programming.

-Michael
 
K

Kenneth Brody

Hello it takes about 30M memory to run my program.
Can anyone give me some suggestions on why it costs so much memory?

You have an error on line 42.

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:[email protected]>
 
P

poison.summer

Sorry could you please explain more detailedly?
What's line 42?
Thanks a lot!
 
B

Ben Pfaff

Sorry could you please explain more detailedly?
What's line 42?

It means "we don't know anything about your program or your
system, so we can't tell you why it's using a lot of memory."
 
K

Keith Thompson

Sorry could you please explain more detailedly?
What's line 42?
Thanks a lot!

Assuming you're serious ...

"line 42" is a wild guess about where the problem in your program
might be. It's a joke. Since you've given us absolutely no useful
information that would help us answer your question, that's the best
we can do.

And please don't assume we can see the article to which you're
replying. You need to provide some context. Google makes it
gratuitously difficult to do this properly, but there is a workaround
(that's been posted here over 1000 times).

If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.

And please complain to Google about their broken interface. They can
do whatever they like with their own private non-Usenet groups, but
they are damaging Usenet, something that's been around decades longer
than they have.
 
E

Eric Sosman

Sorry could you please explain more detailedly?
What's line 42?

It's the successor of the successor of the successor of
the successor of the successor of the successor of the successor
of the successor of the successor of the successor of the
successor of the successor of the successor of the successor
of the successor of the successor of the successor of the
successor of the successor of the successor of the successor
of the successor of the successor of the successor of the
successor of the successor of the successor of the successor
of the successor of the successor of the successor of the
successor of the successor of the successor of the successor
of the successor of the successor of the successor of the
successor of the successor of the successor of line 1.

And, to anticipate your follow-up question: line 1 is
the first line you did not show us.

"Doctor, I don't feel so good. What's wrong?"

"Based on the information you've provided, I conclude
that there's something wrong with your body. Pay the
receptionist on your way out. Next!"
 
M

Mark McIntyre

On 16 Nov 2005 11:48:23 -0800, in comp.lang.c ,
Hello it takes about 30M memory to run my program.
Can anyone give me some suggestions on why it costs so much memory?

30M isn't a lot. When your programme takes 8GB, then you can
complain...

Seriously tho, who knows? You've not said anything at all about what
your programme does., or shown any code fragments.
 
M

Mark McIntyre

On 16 Nov 2005 13:22:33 -0800, in comp.lang.c ,
Sorry could you please explain more detailedly?
What's line 42?

Please read the Hitchikers Guide to the Galaxy. The meaning of "42"
will then become clear.

Also, please read my sig
 
I

Ingo Menger

Hello it takes about 30M memory to run my program.

How do you know that?
Can anyone give me some suggestions on why it costs so much memory?

Only if you can give me a suggestion on why I need around 1000 galloons
of heating oil per annum to heat my home.
 
K

Kenneth Brody

Ingo said:
How do you know that?


Only if you can give me a suggestion on why I need around 1000 galloons
of heating oil per annum to heat my home.

Obviously, your furnace has an error on line 42. :)

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:[email protected]>
 
M

Mark B

Hello it takes about 30M memory to run my program.
Can anyone give me some suggestions on why it costs so much memory?
Thanks a lot!

I'm having the same problem... but my code doesn't have 42 lines so I'm not
sure what's wrong!

#include <stdio.h>
void main(void)
{
char buf[31457280] = "hello world";
puts(buf);
return 0;
}

Hmm... maybe they meant the problem is on lines 4 AND 2...
void main(void)
- just like they have it in my textbook, looks good.
char buf[31457280];
- more than enough space to hold that little string.
Oh well, I guess I'll blame my compiler... it is a pig ;)
 
M

Mike Wahler

Ingo Menger said:
How do you know that?


Only if you can give me a suggestion on why I need around 1000 galloons
of heating oil per annum to heat my home.

Your gallons are too small.

-Mike
 
K

Keith Thompson

Ingo Menger said:
How do you know that?


Only if you can give me a suggestion on why I need around 1000 galloons
of heating oil per annum to heat my home.

Probably because galloons (narrow bands or braids used as trimming and
commonly made of lace, metallic thread, or embroidery) aren't very
efficient containers for heating oil.
 
R

Richard Heathfield

Mark B said:
Hello it takes about 30M memory to run my program.
Can anyone give me some suggestions on why it costs so much memory?
Thanks a lot!

I'm having the same problem... but my code doesn't have 42 lines so I'm
not sure what's wrong!

#include <stdio.h>
void main(void)
{
char buf[31457280] = "hello world";
puts(buf);
return 0;
}

Hmm... maybe they meant the problem is on lines 4 AND 2...
Yeah.

void main(void)
- just like they have it in my textbook, looks good.

Your faith in your textbook is touching. But wait...
char buf[31457280];
- more than enough space to hold that little string.

....that's a very curious number which, I am convinced, was carefully chosen
for a certain property it has. If I'm right, then I would guess that your
main error was deliberate, too.
Oh well, I guess I'll blame my compiler... it is a pig ;)

Could I suggest gcc instead? Pigs are not particularly celebrated for their
ability to produce particularly efficient object code.
 

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

Forum statistics

Threads
474,173
Messages
2,570,939
Members
47,475
Latest member
NovellaSce

Latest Threads

Top