Memory leak (?) in @SMPEEK

May 20, 2008
12,167
133
Syracuse, NY, USA
When this has run for a few seconds (thousands of iterations)

Code:
set h=%@smopen[1024,sm1]
do forever ( if "%@smpeek[%h,0,1]" NE "0" echo foo )

TCC's memory use has increased by 3-4 MB and these start showing up in the console.

Code:
TCC: (Sys)  "%@smpeek[536,0,1]"
Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command

and the DO loop cannot be halted with Ctrl-C.
 
May 20, 2008
12,167
133
Syracuse, NY, USA
When this has run for a few seconds (thousands of iterations)

Code:
set h=%@smopen[1024,sm1]
do forever ( if "%@smpeek[%h,0,1]" NE "0" echo foo )

TCC's memory use has increased by 3-4 MB and these start showing up in the console.

Code:
TCC: (Sys)  "%@smpeek[536,0,1]"
Usage : IF [/I] [NOT] condition [.AND. | .OR. | .XOR. [NOT] condition ...] command

and the DO loop cannot be halted with Ctrl-C.
As a comparison, there does not seem to be a memory leak when I do this:
Code:
do forever ( if "%@smread[%h,0,a,4]" NE "" echo foo )
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Also, HELP @SMOPEN (or any other @SM function) fail; likewise, HELP F_SMOPEN style also fails.
HELP file: 2012-05-15 22:44:18 4,165,242 160CA31D tcmd.chm
TCC 14.00.14 Windows XP [Version 5.1.2600]

Is it possible for @SMOPEN to reference the shared memory tables already created by SHRALIAS, and if so, what are the names of the alias,function, command history, and directory history shared memory areas?

Is there a method to enumerate the names and sizes of existing shared memory blocks?

Is there a method to to list the open shared memory handles?
 

samintz

Scott Mintz
May 20, 2008
1,555
26
Solon, OH, USA
If you run Process Explorer from SysInternals, you can view the names of the handles in use.

I created a named shared memory region of size 1024. I dumped the contents using this code:
Code:
do i=0 to 1023 (echos` ` %@convert[10,16,%@smpeek[%sm,%i,1]])

And monitoring the Working Set size of TCC.exe in Process Explorer, I see it grow by over 4K each time I run it.
 

rconn

Administrator
Staff member
May 14, 2008
12,556
167
Is it possible for @SMOPEN to reference the shared memory tables already created by SHRALIAS, and if so, what are the names of the alias,function, command history, and directory history shared memory areas?

There is no way I'm going to support that!

Is there a method to enumerate the names and sizes of existing shared memory blocks?

Not supported by Windows.

Is there a method to to list the open shared memory handles?

No.