|
-
July 13th, 2011, 11:05 AM
#1
Allocate disc space
Ok, here is the problem, I want to try running functions on large files to see how long the will take to run, but I don't want to make huge text files and run the functions against them. Is there a way to allocate memory, let's say 100mb and then run a function on those bytes/bits? (the content doesn't matter)
-
July 13th, 2011, 06:51 PM
#2
Re: Allocate disc space
It would not be an acurate test, If you need to check the speed of processing large files then you should work with large files. Memory is much faster that file i/o
Surely you have some large files already on the system
Always use [code][/code] tags when posting code.
-
July 13th, 2011, 09:19 PM
#3
Re: Allocate disc space
DataMiser is correct. However, should you still want to pursue this, you may find MemoryStream (link) to be useful. In short, it is a Stream (like a filestream) that is backed by a byte array.
Hope that helps!
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
-
July 14th, 2011, 07:56 AM
#4
Re: Allocate disc space
With the respect to DataMiser's point, I've used following unmanaged methods to (de)allocate large amout of memory
Code:
IntPtr p = Marshal.AllocHGlobal(size);
Marshal.FreeHGlobal(p);
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|