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?
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
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