flat assembler
Message board for the users of flat assembler.
Index
> Windows > memory usage |
Author |
|
kohlrak 29 Apr 2007, 14:03
I don't know about memory leaks (as i'm pretty darn prone to them, which woudln't surprise me if AOL and such have such issues), but if you can save your memory to disk and hex edit the file (difficult way to do it, actually) or if you have any better methods, you could always leave a small variable in the function or section in question (a db variable saying "sleeepsleepcheck" or something like that) and search for that. That's usually what i would do if i had any programs that i wanted to claim as mine, since not many would probably go around hex editing every program that they like.
|
|||
29 Apr 2007, 14:03 |
|
LocoDelAssembly 29 Apr 2007, 15:38
Instead of calling directly to the API functions you can call your own funtions that first increments a counter and then call the desired function. The same with deallocating/closing functions but decrementing the counter instead. If counter is not zero on exit you have a leak.
|
|||
29 Apr 2007, 15:38 |
|
f0dder 02 May 2007, 23:00
Using your own wrappers is a very good idea indeed - and if fasm supported conditional assembly, it would be even easier to do it decently :]
There's commercial tools that are pretty good (boundschecker...), but they tend to be pretty expensive. |
|||
02 May 2007, 23:00 |
|
vid 02 May 2007, 23:09
Quote: and if fasm supported conditional assembly, it would be even easier to do it decently i am not sure what exactly you mean by "conditional assembly", but probably something like this? Code: if used malloc malloc: inc [alloc_count] call [imported_malloc] end if |
|||
02 May 2007, 23:09 |
|
vid 03 May 2007, 09:48
LocoDelAssembly wrote: Instead of calling directly to the API functions you can call your own funtions that first increments a counter and then call the desired function. The same with deallocating/closing functions but decrementing the counter instead. If counter is not zero on exit you have a leak. using similar approach you can also count allocated memory. Problem might be with reallocation. pseudocode to count sum of allocated memory (which is not real usage btw...): Code: my_alloc(size): block=alloc(size+4) dword [block] = size; total_size += size; return block+4; my_realloc(block, newsize): total_size -= dword [block-4] block=realloc(block-4, newsize+4); dword [block] = newsize; total_size += newsize; return block+4; my_free(block); total_size -= dword [block-4] free(block-4) |
|||
03 May 2007, 09:48 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.