BBC BASIC for Windows
« Memory Usage Monitor utility »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:58pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Memory Usage Monitor utility  (Read 1498 times)
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Memory Usage Monitor utility
« Thread started on: Jul 20th, 2009, 5:46pm »

I've created an add-in utility which has exactly the same functionality as the 'memory usage monitor' to be found on the Wiki, but without the inconvenience of having to incorporate the code into your own program. It's also useful when you don't have enough free memory to add the code (e.g. if you're using the trial version of BB4W). Here it is:

http://groups.yahoo.com/group/bb4w/files/Tools/Add_Ins/memorymonitor.exe

For details of what it reports and other notes see the original Wiki article:

http://bb4w.wikispaces.com/Memory+usage+monitor

To achieve this functionality the utility 'injects' both assembler and BASIC code into a remote process, and causes the injected BASIC code to be called 'invisibly' from the program being monitored. This is probably the most challenging thing I have ever attempted in BB4W!

As is usual for add-in utilities you must run the program once in order to install it; thereafter you access the utility from the BB4W 'Utilities' menu (after restarting BB4W if necessary). You don't need to download the utility to your PC first; you can simply install it from the group's Files area if you want to. Adminstrative privileges are required for installation; if you are prompted to execute the program a second time with elevated privileges (e.g. on Windows Vista) then do so.

To remove the utility, or to move it to another 'slot', just run the program again. Alternatively you can use Malcolm Marten's 'Utilities Manager' for these tasks.

Richard.
« Last Edit: Jul 20th, 2009, 5:46pm by admin » User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Memory Usage Monitor utility
« Reply #1 on: Jul 22nd, 2009, 11:36am »

on Jul 20th, 2009, 5:46pm, Richard Russell wrote:
To achieve this functionality the utility 'injects' both assembler and BASIC code into a remote process, and causes the injected BASIC code to be called 'invisibly' from the program being monitored. This is probably the most challenging thing I have ever attempted in BB4W!



Is there any chance of me/us getting a glimpse of this code?

Michael smiley smiley smiley smiley smiley smiley smiley smiley
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Memory Usage Monitor utility
« Reply #2 on: Jul 22nd, 2009, 7:09pm »

Quote:
Is there any chance of me/us getting a glimpse of this code?

I'm afraid it wouldn't make much sense even if I showed you, since it depends so much on undocumented internals of BB4W which only I know about.

If you tried to adapt it, without a full understanding of how it works, at best you'd end up with unreliable code and at worst code that crashed without the slightest chance of being able to find out why!

I can understand some frustration that I am the only person who can squeeze such 'unintended' functionality from BB4W, but bear in mind that with most programming languages it's impossible (even for the author) to achieve such things because the 'hooks' simply don't exist.

Richard.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Memory Usage Monitor utility
« Reply #3 on: Jul 23rd, 2009, 5:54pm »

Quote:
Is there any chance of me/us getting a glimpse of this code?

A couple of further points which may be of relevance/interest:

1. Code 'injected' into a remote process (using the method I used in the Memory Monitor utility, which is the only way I know how to do it) cannot contain any procedures, functions, subroutines or labels (or line numbers used as destinations for GOTO etc.). This limits the usefulness of the technique, perhaps to the extent that you may feel less bad about not being able to adopt it!

2. The 'code injection' process relies on the same trick that the TIMERLIB and SUBCLASS libraries use. It is purely fortuitous that my original design for BB4W made it possible; I could very easily have used a slightly different approach which wouldn't have been amenable to being 'hijacked' in this way. I'm not denying you access to any capability that BB4W was designed to have!

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Memory Usage Monitor utility
« Reply #4 on: Jul 24th, 2009, 01:37am »

Richard,

No worries, as they say down under. I understand the internal workings of BB4W are probably best left alone by people like me! I have successfully 'injected' some assembler code into a remote process for subclassing a window but I suppose I was interested to see what you meant by the BASIC code as well. However, I'm still 'experimenting' with what I have actually done and am trying to find something useful to do with it!!! I was particularly interested in how you get the dialogue box to function 'in the other process' but I'm not too sure what I would use it for!

Anyway, very interesting achievement! Congratulations!
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Memory Usage Monitor utility
« Reply #5 on: Aug 28th, 2010, 6:16pm »

In response to the request for a tool to allow memory contents to be listed, I have updated the 'memory monitor' utility so that, optionally, it displays not only the current memory usage but also the contents of a specified block of memory:

http://groups.yahoo.com/group/bb4w/files/Tools/Add_Ins/memorymonitor.exe

The utility now presents a 'Display memory contents' button. If pressed, a 'memory dump' window is displayed in which the contents of 128 contiguous bytes of memory are displayed in both hex and ANSI.

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Memory Usage Monitor utility
« Reply #6 on: Jan 12th, 2011, 5:54pm »

Quote:
Owing to what appears to be a bug in 64-bit Windows, some add-in utilities (notably Memory Monitor and Module Viewer) don't run on that platform. Version 5.92a incorporates a workaround for this issue, allowing revised versions of those utilities to run.


I run BB4W on Vista 64 bit. I cannot use Memory Monitor. I always to get "Cannot Start remote thread" error message with 10+ tries... sad

Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Memory Usage Monitor utility
« Reply #7 on: Jan 12th, 2011, 9:40pm »

on Jan 12th, 2011, 5:54pm, Michael Hutton wrote:
I run BB4W on Vista 64 bit. I cannot use Memory Monitor. I always to get "Cannot Start remote thread" error message with 10+ tries

The current version of Memory Monitor (v2.2) doesn't even contain the error message Cannot Start remote thread so I would strongly suspect you are running an old version! The easiest way to replace it with the latest version is to navigate to the ADDINS folder and run the memorymonitor.exe that you will find there. Alternatively you can download it from the group.

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Memory Usage Monitor utility
« Reply #8 on: Jan 13th, 2011, 03:49am »

Sorry, my fault completely, in fact I had not even run the latest upgrade on this machine, which I thought I had. Sorry, my bad.

Just to confirm it works now.

Michael
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls