Inline Code Example Here
I am using a pair of pthreads that call a pair of functions for ping-pong dma data transfer that are used in a loop for data transfer from an acquisition board. For a large # of waveforms, I ultimately run out of PC memory and the program stops. At the end of each function I use the delete[] command to clear memory for reuse, but the pointer appears to advance by the array size used for the transfer until the location exceeds the 2 GB I have for memory. I can see this happening using the Task Manager performance button time plot and window of total memory used continuing to increase to the limit. Orignially, I had an array dimensioned in each procedure, and it used up memory twice as fast. When I transferred the line to an area just prior to main and used a constant 1024 for length, the program ran twice as far before exceeding system memory, so it appears that both lines were forcing new memory assignments and moving the pointers accordingly. In addition to using the delete[] command to free memory unsucessfuly at the end of each function procedure, I ended up closing the memory at the end of each procedure, then reallocating it again with the idea that the pointer would be set back to the original value, but it still seems to icrement along. So, neither approach appears to allow reuse of the memory because the pointer continues to march along. Any ideas how to solve this? Using Visual C++ 6.0 to compile.
isrinc
0
Newbie Poster
Recommended Answers
Jump to PostPlease post a sample program that exhibits the problem.
Jump to PostWell I cant tell anything from this. What line is causing the problem? I am not seeing a call to
delete []
anywhere in this function forRO
orIO
.
All 5 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
isrinc
0
Newbie Poster
NathanOliver
429
Veteran Poster
Featured Poster
isrinc
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.