Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C Sharp only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
C Sharp
Dynamic memory allocation
Collapse
This topic is closed.
X
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
Le Minh
#1
Dynamic memory allocation
Oct 5 '06, 04:55 PM
Hi, i try to using unsafe programming to speed up my App.
i dont know how to dynamic memory allocate.
Anyone know it ?
Thanks,
Le Minh.
Tom Porterfield
#2
Oct 5 '06, 04:55 PM
Re: Dynamic memory allocation
Le Minh wrote:
Hi, i try to using unsafe programming to speed up my App.
i dont know how to dynamic memory allocate.
>
Anyone know it ?
Can you provide more details? What is it about your app that is slow and
how/why do you think using unsafe code will speed it up?
--
Tom Porterfield
Comment
Post
Cancel
Le Minh
#3
Oct 5 '06, 05:15 PM
Re: Dynamic memory allocation
My App is processing image. It use GDI+ and it so slow. I want to manipulate
image in byte stream and hope it will better, so i need pointer.
Comment
Post
Cancel
Daniel
#4
Oct 5 '06, 05:45 PM
Re: Dynamic memory allocation
Are you saying you dont know how to use pointers and addresses?
if so:
int var = 5; //assigns 5 to a memory space the size of int bytes
int * ptr;
ptr = &var; // makes ptr a reference poiting to the memory space of
var....sp ptr = 5;
*ptr = 10; //sets the memory space that ptr points to, to
10.........now var also equals 10.
*ptr= null; //frees memory and also means var is now null
....er does that help?
"Le Minh" <hanami279@hotm ail.comwrote in message
news:%23yrl%23M K6GHA.4644@TK2M SFTNGP05.phx.gb l...
My App is processing image. It use GDI+ and it so slow. I want to
manipulate image in byte stream and hope it will better, so i need
pointer.
>
Comment
Post
Cancel
Le Minh
#5
Oct 5 '06, 06:25 PM
Re: Dynamic memory allocation
Are you saying you dont know how to use pointers and addresses?
No, i want a memory allocation function. It maybe like malloc function in
C++.
Can we do the same in C#?
Thanks
Comment
Post
Cancel
Mattias Sjögren
#6
Oct 5 '06, 08:05 PM
Re: Dynamic memory allocation
>No, i want a memory allocation function. It maybe like malloc function in
>C++.
>Can we do the same in C#?
What's wrong with using the new operator to create a new byte array
(or other suitable array type)?
The only other allocation operator in C# is stackalloc to allocate
memory from the stack.
Then there are the Marshal.Alloc methods for allocating memory from a
native heap.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
|
http://www.dotnetinterop.com
Please reply only to the newsgroup.
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment