Click here to Skip to main content
15,913,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalsetting up Internet Connection Sharing programmatically Pin
15-Feb-01 8:55
suss15-Feb-01 8:55 
QuestionHow to prevent Windows from erasing my control prior to DrawItem()? Pin
15-Feb-01 8:52
suss15-Feb-01 8:52 
AnswerRe: How to prevent Windows from erasing my control prior to DrawItem()? Pin
Tim Deveaux16-Feb-01 4:04
Tim Deveaux16-Feb-01 4:04 
GeneralEnumerating dll exports Pin
15-Feb-01 8:11
suss15-Feb-01 8:11 
GeneralEnding processes notification Pin
confalonieri15-Feb-01 6:11
confalonieri15-Feb-01 6:11 
GeneralRe: Ending processes notification Pin
l a u r e n15-Feb-01 6:52
l a u r e n15-Feb-01 6:52 
GeneralRe: Ending processes notification Pin
19-Feb-01 5:01
suss19-Feb-01 5:01 
GeneralVirtual Memory paging when an app minimizes Pin
John M. Drescher15-Feb-01 6:04
John M. Drescher15-Feb-01 6:04 
I have the following problem with virtual memory on NT. I have a 900Mhz athlon with 256MB of pc133 memory in windows NT 4.0 SP6a. I am developing and application to digitize 30 to 50 MB images (mammograms). The digitizer has 16 MB buffer and takes about 1 minute to digitize a film. The digitizer may not stop if the buffer is overrun so my program must not be inactive for more than 10 to 15 seconds. You would think this is easy. The problem is that I need to load 1 to 6 images into memory at a time. The system has enough memory to hold 4 images and swapping out parts of the images is not too bad as long as it does not make my application inactive for more than 10 seconds. The application's process is set to high priority and the task that reads the data is also a high priority thread. I set the minimum working set size to 128MB. Everything works fine with the application until I press the minimize button when the application is using 200+ MB of physical memory. When this occurs NT 4.0 pages out all the memory but about 2MB. The problem is that during this paging operation (thrashes for over 20 seconds), my application does not get enough cpu cycles to read the data from the digitizer and the buffer becomes overrun. I cannot allow this to happen because we are developing a time critical application and any failures will cause the whole operation to be aborted and a tech will have to restart the process from the beginning.. My solution for now is to disable the minimize application button, but is there a way without a Virtual Lock on each image to force NT not to page out all images at once.

Here are my allocation statements:
BOOL CImage::AllocateBuffer(UINT nMaxRows, UINT nMaxCols)
{
BOOL retVal = ( m_pBuffer == NULL );
if ( retVal ) {
m_nMaxCols = nMaxCols;
m_nMaxRows = nMaxRows;
m_pBuffer = (PWORD)VirtualAlloc(NULL,nMaxCols * nMaxRows * sizeof(WORD),
MEM_RESERVE,PAGE_READWRITE);

retVal = ( m_pBuffer != NULL );
}
return retVal;
}

BOOL CImage::CommitBuffer(UINT nOffsetBytes, UINT nBytes)
{
BOOL retVal = ( m_pBuffer != NULL );
if ( retVal ) {
PBYTE pBuf = (PBYTE)m_pBuffer;
VirtualAlloc(&pBuf[nOffsetBytes],nBytes,
MEM_COMMIT,PAGE_READWRITE);
}
return retVal;
}

BOOL CImage::FreeBuffer()
{
BOOL retVal = ( m_pBuffer != NULL );
if ( retVal ) {
retVal = VirtualFree(m_pBuffer,0,MEM_RELEASE);
}
return retVal;
}

Allocate buffer allocates a memory block for the image. I don't commit the memory during the allocate, because I don't know the size of the image until I finish digitizing. I allocate the largest possible image size and I commit sections of the buffer as I read the data from the digitizer.

Thanks in Advance,
John M. Drescher
GeneralRe: Virtual Memory paging when an app minimizes Pin
l a u r e n15-Feb-01 6:47
l a u r e n15-Feb-01 6:47 
GeneralRe: Virtual Memory paging when an app minimizes Pin
John M. Drescher15-Feb-01 7:02
John M. Drescher15-Feb-01 7:02 
GeneralRe: Virtual Memory paging when an app minimizes Pin
19-Feb-01 4:54
suss19-Feb-01 4:54 
GeneralMFC, image processing, doc/view architecture Pin
15-Feb-01 4:59
suss15-Feb-01 4:59 
GeneralRe: MFC, image processing, doc/view architecture Pin
l a u r e n15-Feb-01 6:41
l a u r e n15-Feb-01 6:41 
GeneralRe: MFC, image processing, doc/view architecture Pin
John Kelly15-Feb-01 7:05
John Kelly15-Feb-01 7:05 
GeneralRe: MFC, image processing, doc/view architecture Pin
Chris Losinger15-Feb-01 7:54
professionalChris Losinger15-Feb-01 7:54 
GeneralRe: MFC, image processing, doc/view architecture Pin
John Kelly27-Feb-01 3:42
John Kelly27-Feb-01 3:42 
GeneralRe: MFC, image processing, doc/view architecture Pin
Christian Graus15-Feb-01 8:24
protectorChristian Graus15-Feb-01 8:24 
GeneralRe: MFC, image processing, doc/view architecture Pin
John Kelly27-Feb-01 3:26
John Kelly27-Feb-01 3:26 
GeneralParallel port monitor in Windows 2000 Pin
Wayne Ware15-Feb-01 3:25
Wayne Ware15-Feb-01 3:25 
GeneralOld Version of CJTools Pin
#realJSOP15-Feb-01 3:21
professional#realJSOP15-Feb-01 3:21 
GeneralRe: Old Version of CJTools Pin
17-Feb-01 3:45
suss17-Feb-01 3:45 
GeneralRe: Old Version of CJTools Pin
17-Feb-01 4:04
suss17-Feb-01 4:04 
GeneralQ: OnOpenDocument Pin
15-Feb-01 2:41
suss15-Feb-01 2:41 
GeneralRe: Q: OnOpenDocument Pin
l a u r e n15-Feb-01 6:36
l a u r e n15-Feb-01 6:36 
GeneralCreating RadioButton Control Pin
15-Feb-01 1:09
suss15-Feb-01 1:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.