LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

The usage of MapPhysicalMemory()

Hello ,

There is 2 questions about the MapPhysicalMemory() function .

1,Assuming the RAM volume in my PC is 256 M , except running my application , maybe
also at the same time running other applications such as Word ,AutoCAD etc., I am
not sure if there would result memory allocating overflow ?

2,The first parameter of the function give out such a help : "The physical address
to be mapped into user memory. There are no restrictions on the address. It can be
below or above 1 Megabyte.", I'd like to know if it means I can label any number of
address to it ? if it can , how to prevent other process to access the address?

Thanks!

David
0 Kudos
Message 1 of 4
(3,032 Views)
David,

The function MapPhysicalMemory() allows you to take control over a certain area of the memory. Usually this function is used to communicate some sort of I/O hardware device that was mapped into memory and that you know the are of the memory to read or write. If you just need to allocate some memory for operations in you code I would suggest that you stay with malloc()or calloc(); this function will return a pointer to NULL if there was not enough memory available. Also malloc will reserve the memory so that other applications cannot access it.

Let me know if you have other questions.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 2 of 4
(3,032 Views)
Juan,

I agree with your idea . In fact , I want to maintain a real time database resides in the memory,and its volume is variable . I know if it takes too many space , the application performance will be reduced. How to make a policy to guarantee the application performance and also get a quickly memory data access ? Would you please introduce me how to make a
SWAP technology in CVI ? Hope you can give a simple example . My CVI version is 6.0.

By the way , I want to start a remote application by using DCOM , e.g., remote start a SCADA system engine , I have not program activeX with cvi . Thanks .

David
0 Kudos
Message 3 of 4
(3,032 Views)
David,

There are two performance parameters that you should be concerned: memory space and speed. If you keep the database in memory then you application is very fast; if you keep it on a file then it uses very low memory, but it's slower. The bottom line is the type of operation will you be performing to your data. For example, if you are going to do constant searches in the data it may be convenient to have it loaded in memory. But if you have some sort of indexing where you can just read from the file that index, you can keep the file reference open and just read from the index that you calculated just the data the you need.

I'm not familiar with SWAP technology, is this some sort of memory management algorithm?

About starting an applica
tion via ActiveX there are some tools that you'll find useful, CVI has a wizard that can create function panels to control an activeX applicationyou can find it in Tools>>Create ActiveX controller... There are also a good set of examples that you can find in \Program Files\National Instruments\MeasurementStudio\CVI\samples\activex

I hope this helps,

Juan Carlos

N.I.
0 Kudos
Message 4 of 4
(3,032 Views)