olegsp
asked on
beginthread and paging file size
I am using _beginthread in my program with a classical statement like:
_beginthread(start_func, 0, this);
where "start_func" is some static class member, and "this" points to another class from where beginthread is called. When I first compiled and ran the program (VC 6.0, Windows NT), my beginthread kept failing with error code 1455 - "insufficient paging file size". I had to TRIPLE the paging file size before this problem disappeared.
Why does it need so much space (virtual memory, I assume)? Is this anyhow related to the actual size of the class pointed by "this" that I am passing to the thread (even though I am passing a pointer) ??
Are there any other ways to minimize the amount of virt. memory required by a thread without inflating the paging files???
_beginthread(start_func, 0, this);
where "start_func" is some static class member, and "this" points to another class from where beginthread is called. When I first compiled and ran the program (VC 6.0, Windows NT), my beginthread kept failing with error code 1455 - "insufficient paging file size". I had to TRIPLE the paging file size before this problem disappeared.
Why does it need so much space (virtual memory, I assume)? Is this anyhow related to the actual size of the class pointed by "this" that I am passing to the thread (even though I am passing a pointer) ??
Are there any other ways to minimize the amount of virt. memory required by a thread without inflating the paging files???
ASKER
Yeas, this might be the case, since I was copying some data into the thread to avoid potential sharing conflicts with the main application. As far as I know, a thread will allocate its own address space withing the address space of the main process, so (correct me if I am wrong)
1. If I pass a pointer to a thread, the thread will duplicate this pointer (32 bits) but not the object it points to?
2. If some object has global scope, and I use it in a thread, will it be replicated by the thread or not ?
I guess I am driving to "If I need to pass a lot of data to a thread, should I use pointers, global scope variables or anything else" ?
1. If I pass a pointer to a thread, the thread will duplicate this pointer (32 bits) but not the object it points to?
2. If some object has global scope, and I use it in a thread, will it be replicated by the thread or not ?
I guess I am driving to "If I need to pass a lot of data to a thread, should I use pointers, global scope variables or anything else" ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, you've answered to all my questions.
There isn't much we can say to help you without knowing more about your program and this class.