www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/06/08:50:05

From: a AT b DOT com (Hbar)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Amount of Memory used by a djgpp program.
Date: Thu, 06 Jul 2000 10:36:26 GMT
Organization: The Hebrew University of Jerusalem
Lines: 28
Message-ID: <3964605e.336726@news.huji.ac.il>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000705191516 DOT 14785C-100000 AT is>
NNTP-Posting-Host: ufo1.weizmann.ac.il
Mime-Version: 1.0
X-Trace: news.huji.ac.il 962879788 23434 132.77.40.26 (6 Jul 2000 10:36:28 GMT)
X-Complaints-To: usenet AT news DOT huji DOT ac DOT il
NNTP-Posting-Date: 6 Jul 2000 10:36:28 GMT
X-Newsreader: Forte Agent 1.5/32.451
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Sorry for that. What I ment was that if for instance I measure 104Kb
usually, then running again with slight modification (clearly
unrelated to memory usage) I get 170MB as output. I thought that my
casting choise is wrong. Maybe the program allocate memory not
sequentially?


On Wed, 5 Jul 2000 19:16:38 +0300 (IDT), Eli Zaretskii
<eliz AT is DOT elta DOT co DOT il> wrote:

>
>On Wed, 5 Jul 2000, Hbar wrote:
>
>> Thnx, I'm using this method, but sometimes I'm getting proper numbers
>> and sometimes not. Am I casting wrong? Should the *mem pointers be
>> void? This is my code:
>> 
>> char *memi,*memf;
>> memi=(char *)sbrk(0);
>> //my program
>> memf=(char *)sbrk(0);
>> printf("\nTotal memory used %dKb\n",((unsigned
>> long)(memf-memi))/1024);
>
>It would help *tremendously* if you say what are the ``improper'' numbers 
>that you get sometimes.  I'm not good enough at guessing something that 
>happens out of my sight ;-)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019