Developing a Video Monitoring System Documentary 10 memory failures during video recording

Source: Internet
Author: User

Previously, the delegate is converted into an internal variable of a method. The result is recorded as follows:

For "WindowsApplication1! Pixysoft. HikVision. STREAM_DIRECT_READ_CALLBACK: Invoke "type of garbage collection delegate for callback. This may cause application crash, damage, and data loss. When delivering delegates to unmanaged code, managed applications must keep these delegates active until you are sure they will not be called again.

 

After being recorded as an external domain video for more than 10 seconds, the system prompts: Try to read or write the protected memory. This usually indicates that other memory is damaged.

 

It is estimated that the memory is released...

 

The following is a summary of delegate. References:

Http://msdn.microsoft.com/zh-cn/library/43yky316 (VS.80). aspx

Http://topic.csdn.net/u/20080423/03/43b58852-5cac-4aac-a7da-6a69e69b21cd.html

 

Reference:

Http://msdn.microsoft.com/zh-cn/library/system.gc.keepalive.aspx

Http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.languages.csharp/2006-09/msg01380.html

Http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d12c13a6-f103-48c8-9933-291a1685941a/

Http://blog.csdn.net/fanweiwei/archive/2007/09/11/1780742.aspx

Http://social.msdn.microsoft.com/Forums/en-US/clr/thread/66ea26a6-7c3d-4e96-9336-e3f148659f22/

Http://topic.csdn.net/u/20080423/03/43b58852-5cac-4aac-a7da-6a69e69b21cd.html

Keyword: GC, CALLBACK, DELEGATE, DLLIMPORT

 

The problem is solved. Is an interface declaration problem:

 

Incorrect statement:

Public delegate int StreamDirectReadCallback (int channelNumber, [financialas (UnmanagedType. LPArray, SizeConst = 704*576*5)] byte [] DataBuf, uint Length, Pixysoft. hikVision. DS40xxSDK. frameType_t FrameType, System. intPtr context );

 

Correct statement:

Public delegate int StreamDirectReadCallback (int channelNumber, IntPtr DataBuf, uint Length, Pixysoft. HikVision. DS40xxSDK. FrameType_t FrameType, System. IntPtr context );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.