Jump to content

Could not screenshot.


gameboy
 Share

Recommended Posts

Today, I tested the latest SVN17557 and found a problem: when I press the key shift+f2 in the game, the game appears the wrong message:

My operating system is Win8 64bit. my memory is 8G

ERROR: Error writing screenshot to 'screenshots/screenshot0010.bmp'

Out of address space (64-bit OS may help)

Location: wvm.cpp:297 (vm::AddressRangeDescriptor::Allocate)

Call stack:

(error while dumping stack: No stack frames found)

errno = 0 (No error reported here)

OS error = 8 (?????????????)

commands.txt

Edited by gameboy
Link to comment
Share on other sites

I found a way, but how to apply this method into the code, still ask everybody to help me. :smoke:




Virtual is kept within area is based on 64 KB. In the area of the page can be submitted from page to page (translator note: when it comes to each page in the Windows CE is in front of the 4096 - byte or 1024 bytes). You can directly submit a page or pages rather than a full page of the reserved area. But for page or pages, directly submit is still a 64 - KB (translator note: may submit the number of pages until it is enough to fill 64 KB really commit), for this reason, the best to keep a 64 - KB of virtual memory, and then submit the page to areas of need.



Because the virtual memory address space to each process 32 MB limit, it has a maximum of 32 MB / 64 KB - 1 = 511, this is before the existence of memory can be retained within the virtual maximum. Next, an example, the code is as follows:



1024 / / # define PAGESIZE Assume we 'r e on a 1 - KB page machine



For (I = 0; I < 512; i++)



PMem [I] = VirtualAlloc (NULL, PAGESIZE, MEM_RESERVE │ MEM_COMMIT, PAGE_READWRITE);



Virtual memory code assigned 512 single page. Do you have half of the available system RAM, even VirtualAlloc will also fail to complete before distribution. Because of its running is beyond the application of the virtual address space. This happens because every 1 - KB block takes up 64 - KB, then the stack, the application code and the local heap is mapped to the same 32 MB virtual address space, the available virtual distribution area is usually not more than 475.



A better distribution of 512 pieces of special memory method is to do it:



1024 / / # define PAGESIZE Assume we 'r e on a 1 - KB page machine.



/ / Reserve a region first.



PMemBase = VirtualAlloc (NULL, PAGESIZE * 512, MEM_RESERVE,



PAGE_NOACCESS);





For (I = 0; I < 512; i++)



PMem [I] = VirtualAlloc (pMemBase + (I * PAGESIZE), PAGESIZE.



MEM_COMMIT, PAGE_READWRITE);



Code first retained an area, the page will be submitted in the future. Because the region has been preserved, first submit page is not restricted by a 64 - KB page (translator note: only retain the minimum restricted by 64 KB), and so on, if you have 512 KB available memory in the system, allocation will be successful.



Although I showed you just now is an artificial example (and virtual memory is better than direct allocation method to allocate memory block 1 KB), an important memory allocation method is verified in the different (for other Windows). In the desktop version of Windows, the work of the application has a full 2 GB virtual address space. In Windows CE, a programmer must understand that each application is kept only a smaller 32 - MB virtual address space.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...