SOT: Windows memory usage

Freeing physical pages is a notoriously hard problem, but there may be a way to force Windows to ignore some of the memory present, then provided your DMA controller is not too simple minded, you could use the unused memory for a DMA target. This does of course require a way to map that otherwise unused memory into a process address space, but details, details....

Some of the older video capture cards did this on Linux, and I assume that something similar can be forced on windows via boot.ini or whatever it calls itself these days (been a while).

Regards, Dan.

Reply to
Dan Mills
Loading thread data ...

SysInternals Process Explorer may help - a reputable freebie now downloadable direct from Microsoft. It is not a comprehensive map of every RAM address though.

Reply to
Steve Walker

Windows malloc does allocate a single contiguous block. If a single contiguous block cannot be allocated it will fail. Have you tried writing your own program to see if you can allocate a block this size? Remember also that the largest amount of space a process can access in total is only 2GB (on 32-bit windows) - maybe the process already has a large chunk of memory allocated and the 128MB you're requesting will go over this limit.

There's a program to find the largest available block here

formatting link

Reply to
chunkyoldcortina

user_pointer to the memory block. This isn't a physical address that you can send to some plug-in card to use in its DMA. How do you convert the malloc pointer to a "real" physical address?

Reply to
Grumps

maybe worth looking here

formatting link
Virtual DMA Specification supported by Windows enhanced mode & standard mode dma.arj Sources that demonstrate how to do DMA in a kernel-mode driver in Windows NT.

Reply to
dennis

There are different "mallocs" for kernel/physical space and for user space. The same as for linux BTW. You have to link to different libraries. Don't ask me which, I haven't done any kernel level programming for years. This is one of those cases where being able to "program" doesn't help unless you know about programming for the hardware.

>
Reply to
dennis

128MB seems like a lot for a DMA transfer - big and slow. Is there some reason you can't DMA smaller chunks (to a contiguous area if you wish)? Maybe that's what the driver / hardware designer had in mind all along...
Reply to
Jules Richardson

The driver/hardware designer was told what to make. The DMA is big and fast. We're running (smaller 800MB/s into PC memory from this hardware (4-lane PCI express). Unfortunately we need to grab more than 32MB in a burst, and the hardware's DMA only has a single transfer address register, and a transfer count. These registers can't be re-programmed quick enough after a small chunk has been received. It if could, then we could just grab loads of little chunks and the DMA would move from one to another.

Reply to
Grumps

Windows malloc() does indeed allocate a single contiguous block - but contiguous in virtual address, not physical.

Andy

Reply to
Andy Champ

I haven't written device drivers in Windows, but I expect it's the same as in unix. The driver will need to call a kernel function to provide a DMA buffer of the specified size, or possibly map a buffer provided by the application (if Windows drivers can support zero copy DMA). The provision of the buffer will take into account the addressability of the card (not all cards can necessarily see all memory). I believe PC's are starting to support IOMMUs (like sparc and other systems have for decades), and in this case the IOMMU can do the scatter/gather, so contiguous space isn't required. Again, I've no idea if Windows supports this.

Generally speaking, kernel virtual memory is a limited resource on

32 bit x86 OS's because it's shared with user virtual memory, although ISTR on Windows, the kernel grabs the whole gigabyte at the top of the 4GB virtual address space (which is much more than is typical on Unix, where more virtual memory is available for the apps). However, 128MB is still 1/8th of the available kernel virtual memory. Shouldn't be a problem on 64 bit OS.
Reply to
Andrew Gabriel

That needs a special configuration. By default it grabs the top TWO gigs. Won't be a problem though, 640k is enough for anyone...

Andy

Reply to
Andy Champ

At a guess I'd say the problem's in the device driver itself.

Also remember that the task manager lies about how much memory is in use.

Reply to
Mark

HomeOwnersHub website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.