~sircmpwn/hare-users

2 2

Is Valgrind working with Hare? Or any way to analyze memory uage

Details
Message ID
<CADVGtmsoMYEJV+XkA9q_9myCm70Xmocr308kn1EXfe2a8h8f2g@mail.gmail.com>
DKIM signature
pass
Download raw message
I am just learning system programming. I have never used any tools for
analytics of memory usage.

So I have two question:
1. Is Valgrind works with Hare? I do not know how it works but it did
not showed unfreed memory in my hare app.
2. Is it enough to log size of every memory allocated in heap to get
an understanding how much app use RAM?

For example here:

export fn main() void = {

   const file = os::open("app.ha")!;
   const file_scan = bufio::newscanner(file, 20); // types::SIZE_MAX

   for(true) {
      fmt::println("file_scan size: ", len(bufio::scan_buffer(&file_scan)))!;
      const line = match(bufio::scan_line(&file_scan)) {
         case let line: const str => yield line;
         case io::EOF => break;
         case utf8::invalid => fmt::fatal("Fatal error");
         case io::error => fmt::fatal("Fatal error");

      };
   };

};

Am I right to understand that my app max memory usage is equal to
`bufio::scan_line` size plus size of `file_scan` internal buffer?
Details
Message ID
<robzi7ed3wfr4awghorith23jdbyklevd5dc7etr6rb7rxhhhq@ap44wtjyoyid>
In-Reply-To
<CADVGtmsoMYEJV+XkA9q_9myCm70Xmocr308kn1EXfe2a8h8f2g@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
Hi Dmitry,

On 24/02/02 17:08:51, Dmitry B wrote:
> So I have two question:
> 1. Is Valgrind works with Hare? I do not know how it works but it did
> not showed unfreed memory in my hare app.

Valgrind can profile hare-programs, if they've been linked with libc.

> 2. Is it enough to log size of every memory allocated in heap to get
> an understanding how much app use RAM?

There are tools, like memusage, that can give you that information,
though I don't know if that is enough to get the full picture.

Cheers,
Enno
Details
Message ID
<CYUQOQU3B5JL.RWMIRD71GGTH@smlavine.com>
In-Reply-To
<robzi7ed3wfr4awghorith23jdbyklevd5dc7etr6rb7rxhhhq@ap44wtjyoyid> (view parent)
DKIM signature
pass
Download raw message
On Fri Feb 2, 2024 at 11:28 AM EST, Enno Tensing wrote:
> Hi Dmitry,
>
> On 24/02/02 17:08:51, Dmitry B wrote:
> > So I have two question:
> > 1. Is Valgrind works with Hare? I do not know how it works but it did
> > not showed unfreed memory in my hare app.
>
> Valgrind can profile hare-programs, if they've been linked with libc.
>
> > 2. Is it enough to log size of every memory allocated in heap to get
> > an understanding how much app use RAM?
>
> There are tools, like memusage, that can give you that information,
> though I don't know if that is enough to get the full picture.
>

Patches welcome to this page <https://harelang.org/tools>, by the way,
with further instructions on those sorts of tools. :)

-- 
Sebastian LaVine
Reply to thread Export thread (mbox)