Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memcpy --- EXC_BAD_ACCESS



Hi, can someone help me with this please?

I experienced occasional EXC_BAD_ACCESS with memcpy while i am reading back image data in DCLcallback.  
both my destination and source buffers are large enough for all the line copy operations as following. 
            for (cycle=0;cycle<PacketCnt;cycle++) //line by line to read the whole image
            {
                printf("\npacket copy: %d",cycle) ;                

                memmove(&pFrameDataWord[currentWordOffset],pPacketBuffer,4092);              
                pPacketBuffer += 4096; //removing 4 bytes header
                currentWordOffset+=4092/2;    
                printf("\ncycle:%d:\tPackCnt:%d",cycle,PacketCnt);
            }

the strange thing is that for the same memory allocation, no matter how many lines I read, it is always the last cycle of memcpy/memove that gets caught. 
If I read 5 lines, the 5th memcpy crashed, if I read 50 lines, the 50th has the problem, although the pPacketBuffer always contains 78 lines and the destination is set for 78 lines.

Debugger reported this:

Allocations will be placed on word (4 byte) boundaries.
- Small buffer overruns may not be noticed.
- Applications using AltiVec instructions may fail.
GuardMalloc-11
Allocations will be placed on word (4 byte) boundaries.
- Small buffer overruns may not be noticed.
- Applications using AltiVec instructions may fail.
GuardMalloc-11

Is this related and how do I avoid this? Thanks

Sufang
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Firewire mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/firewire/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.