login about faq

We are using Chilkat dll(ChilkatDotNet2.dll) for uploading/downloading of zip file(size of around 70 MB). While uploading the Zip content, we are calling OpenFromMemory(Byte[] inData) function which internally calling System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb) function.

Application started throwing System.OutOfMemoryException while calling OpenFromMemory(Byte[] inData) function after some few attempts. So I'm assuming the memory leak occurs in the OpenFromMemory(Byte[] inData) in Chilkat. we tried calling dispose() but that did not fix the leak.

StackTrace: - System.OutOfmemoryException: Insufficient memory to continue the exceution of the program. at System.Runtime.interopService.Marshal.AllocHGlobal(IntPtr cb) at Chilkal.CkMarshal.ManagedToUnmanged(Byte[] x,Int32* lenght) at Chilkat.Zip.OpenFromMemory(Byte[] inData) at eLearnDeployment.Upload.IsZipValid(String courseFoldername, Byte[] content, String&errorText) in e:iisdatawebsitesedeployment.pwcinternal.comDeployUpload.aspx.cs:line 169 at eLearnDeployemnt.Upload.btnUpload_Click(Object sender, EventArgs e) in e:iisdatawebsitesedeployment.pwcinternal.comDeployUpload.aspx.cs:line 94 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.Page.raisePostBackEvent(IPostBackEventHandler sourceControl, Strin eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Oage.Processrequestmain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Please suggest.

asked Dec 05 '12 at 12:18

nandkrlohar's gravatar image


If there is truly a memory leak in Chilkat, it should be easy to prove. To do so, follow these steps:

First, make sure you are using the very latest version of the Chilkat component.

Second, write a very very simple C# program that does the following:

  1. Load the contents of a zip archive into a C# byte array.
  2. Write a simple loop for many iterations, perhaps 10,000 iterations.
  3. Within the loop, call OpenFromMemory, passing it the byte array.
  4. After the call to OpenFromMemory (and within the loop), call GC.Collect() followed by GC.WaitForPendingFinalizers().

This should be a very simple program that is standalone, with no extra application code that could possibly be the cause of the memory leak.

Run the program, and monitor the memory usage using the Windows Task Manager. You should not see memory grow.

Finally, please see this about .NET garbage collection: http://www.chilkatsoft.com/p/p_300.asp It could very well be that your .NET memory usage grows (without garbage collection being triggered), it is near the limit, and then your app tries to allocate a large chunk that pushes it over the edge. This does not necessarily mean there is a memory leak in Chilkat.


answered Dec 05 '12 at 12:58

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Dec 05 '12 at 12:18

Seen: 1,618 times

Last updated: Dec 05 '12 at 12:58

powered by OSQA