Today, when hunting for an (unrelated) bug in my clipboard dumping
script, I found the following gem:

DosQueryMem() can return an arbitrary number as "the size of the
region of memory in pages" - eg., 3 bytes.

The returned information is "correct" (in the sense that it probably
matches the intent of the creator of the memory), but it is not a
multiple of 4096. One should be aware of this...

How to reproduce:

mouse-select a region of screen in a VIO window; then in an application:


open the clipboard (PM required);
query the clipboard;
run DosQueryMem() on the obtained pointer.
close the clipboard

I do not know whether VIO code comes into incestious relationships
with memory manager, or it is just a corollary of calling some 16-bit
API. - when I allocate memory, the return is always in 4K chunks...

Enjoy,
Ilya

P.S. With recent Perls, it should be

perl -MOS2::Process -wle "my $h = OS2::localClipbrd->new;
print $data=ClipbrdData; ($lim) = OS2::Process::MemoryRegionSize($data);
print $lim"