LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   my physical memory just get full (http://www.linuxquestions.org/questions/slackware-14/my-physical-memory-just-get-full-564869/)

hua 06-27-2007 11:43 AM

my physical memory just get full
 
There is something I want to know about c++. I know about a good link http://www.uow.edu.au/~nabg/ABC/C20.pdf

but if I open that pdf - my PCs (three of them) get out of physical memory and cpu time.

Is that caused by some kind of virus. I have no idea. Pleas try somebody open that pdf on slackware (10.2).
It is necessary to have antivirus on slacke? if so which one?

Carpo 06-27-2007 11:55 AM

you could give f-prot a try - its free for linux home users - anotheer thing you could try is the adobe reder (i know i know) and see if you still get the same issues

H_TeXMeX_H 06-27-2007 12:14 PM

It seems that page 3 is a problem ... lemme see ...

pwc101 06-27-2007 12:20 PM

Just for comparison, I have no problems viewing it here at work with a Windows XP box, and it uses around 50MB of RAM according to Windows Task Manager.

It might be worth saving it, converting it to postscript (pdf2ps the_file.pdf that_file.ps) and then back to pdf (ps2pdf that_file.ps that_new_file.pdf), and if there's some sort of problem with the pdf itself, that will probably wipe it out.

H_TeXMeX_H 06-27-2007 12:30 PM

I've been able to use pdftk (site is down at the moment :()to split it into pages, and most pages work, but some are corrupted ... and un-fixable.

Using pdftops, incredibly does NOT help :confused:, now gv uses up 100% CPU usage.

dive 06-27-2007 12:48 PM

When I open it with kpdf only a few pages are readable. Same if I download it.

It's not really necesary to have an anti-virus in linux at all unless you are sending downloaded files or email attachments to a windows box.

uselpa 06-27-2007 02:32 PM

It works fine for me - Slack11, FF2.0.0.4, Adobe Reader 7 w/ FF plugin.

pdw_hu 06-27-2007 02:35 PM

It might be just an ugly error in the .pdf which makes most readers leak memory.

Ilgar 06-27-2007 03:20 PM

I looked at the first five pages, the ones with figures take quite a while to load (but my memory usage didn't go up really). I used xpdf on Slack 11.0 btw..

dive 06-27-2007 03:27 PM

It loaded for me after waiting. Same cpu usage issue.

erklaerbaer 06-27-2007 03:48 PM

kpdf sucked back then. use xpdf , acroread or upgrade to 11.0 (or wait for 12.0 )

what exactly do you want to know about c++ ?

pwc101 06-27-2007 05:35 PM

I downloaded the pdf and ran pdf2ps on it, and got loads of this sort of error:
Code:

  **** Warning: Fonts with Subtype = /TrueType should be embedded.
                But TimesNewRomanPSMT is not embedded.

What I think is pretty funny is the next bit it spat out:
Code:

  **** This file had errors that were repaired or ignored.
  **** The file was produced by:
  **** >>>> Acrobat Distiller 7.0 (Windows) <<<<
  **** Please notify the author of the software that produced this
  **** file that it does not conform to Adobe's published PDF
  **** specification.

I then turned the postscript that produced, back into a pdf, but as H_TeXMeX_H noted, there's something very odd going on on page 3. Perhaps you could email the people who host the file and let them know?

hua 06-28-2007 02:15 AM

to erklaerbaer
 
Quote:

"What you want exactly know about c++"
I am working on a code where I want to fork more processes which will all make its own role in the program.

Code:


int kill;
int processStatus1;

int main()

 int child1, child2, child3 ...
 
 child1 = fork();... calls the refresh function for example...
 child2 = fork();... calls the virtualSpace function ...
 and so on...

 kill =1;

the functions should run in the same time and if the kill state is received all should make their end processes and the whole program terminate...

I was trying define some global variables (kill, processStatus1) but even if I declare in the main -> kill =1; the childs dose note see this state value.
Here comes the above site I thought that I can do that with pointers (the chapter on this pdf is about pointers).
I was wrong. Can you help me to solve my problem?

erklaerbaer 06-28-2007 12:29 PM

uh, don't they teach you programming in school? ;)

anyway i think i can give you some pointers:
- man 2 fork !!
- are you sure that you even need different processes? what about objects?
- ever heard of exceptions?
- don't use int for statuses. either use a more descriptive name and use bool or use your own datatype
- use an array or even better a vector for the childs
- global variables are the square root of evil and should be avoided (unless needed)
- man 2 exit_group?

H_TeXMeX_H 06-28-2007 12:34 PM

I know a good way to know when you need a global variable. First make it local, then after you finish the program (or once you realize the following), if you tend to pass a certain variable to a lot of functions (like the majority of them), then it should be global. You might also want to consider 'static' global.


All times are GMT -5. The time now is 09:37 PM.