Heap allocation from SDRAM
-
I know that this question is not really related to Visual C++ but hopefully there will be someone here who has experience in real-time programming. I'd like to allocate memory using malloc( ) function which allocates it on the internal SRAM. Does anyone know how I could do dynamic memory allocation on the SDRAM?
Time is the fire in which we burn.
-
I know that this question is not really related to Visual C++ but hopefully there will be someone here who has experience in real-time programming. I'd like to allocate memory using malloc( ) function which allocates it on the internal SRAM. Does anyone know how I could do dynamic memory allocation on the SDRAM?
Time is the fire in which we burn.
where else do you think you can dynamically allocate some memory ? use malloc(), it will do the job for you, unless you use C++, then, use new instead. but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
I know that this question is not really related to Visual C++ but hopefully there will be someone here who has experience in real-time programming. I'd like to allocate memory using malloc( ) function which allocates it on the internal SRAM. Does anyone know how I could do dynamic memory allocation on the SDRAM?
Time is the fire in which we burn.
If you need to avoid disk-swapping procedure during memory allocation, maybe this similar discussion -- http://groups.google.com/group/microsoft.public.win32.programmer.kernel/browse_thread/thread/13956625fae7694b/4eb6261aa7f8b1f0?lnk=raot[^] -- will give you some information, I hope.
-
where else do you think you can dynamically allocate some memory ? use malloc(), it will do the job for you, unless you use C++, then, use new instead. but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
where else do you think you can dynamically allocate some memory ? use malloc(), it will do the job for you, unless you use C++, then, use new instead. but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
toxcct wrote:
where else do you think you can dynamically allocate some memory ?
In multiple heap scenarios you can define your own memory segments to specify which area of memory is used to allocate various elements such as messages, semaphores etc. I have a feeling that this is processor dependend and not something that I can do with C standard functions. Is there a way of doing this without depending on the platform being used? I realize that my previous question is not clear enough and I apologize for that. I must stress that this is a Real-Time programming related question.
Time is the fire in which we burn.
-
ohhhhh! nice memory leaks :-) never clean it after yourself! is in C++ 'new' is a stub to call 'malloc'. by the way malloc is much faster than 'new' when called several hundred times.
9ine
9ine wrote:
by the way malloc is much faster than 'new' when called several hundred times
but non reentrant... so, bad !
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
-
where else do you think you can dynamically allocate some memory ? use malloc(), it will do the job for you, unless you use C++, then, use new instead. but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
toxcct wrote:
where else do you think you can dynamically allocate some memory ?
In real-time/embedded systems, where you allocate memory is often just as important as the memory you actually allocate. I believe the OP is asking how he can allocate memory in SDRAM instead of SRAM. I think that is system dependent. I'm trying to remember my VxWorks stuff (haven't used it in a while) ... but I think you have to make a OS API call to allocate memory outside the default heap.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac
-
toxcct wrote:
where else do you think you can dynamically allocate some memory ?
In real-time/embedded systems, where you allocate memory is often just as important as the memory you actually allocate. I believe the OP is asking how he can allocate memory in SDRAM instead of SRAM. I think that is system dependent. I'm trying to remember my VxWorks stuff (haven't used it in a while) ... but I think you have to make a OS API call to allocate memory outside the default heap.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac
-
toxcct wrote:
where else do you think you can dynamically allocate some memory ?
In multiple heap scenarios you can define your own memory segments to specify which area of memory is used to allocate various elements such as messages, semaphores etc. I have a feeling that this is processor dependend and not something that I can do with C standard functions. Is there a way of doing this without depending on the platform being used? I realize that my previous question is not clear enough and I apologize for that. I must stress that this is a Real-Time programming related question.
Time is the fire in which we burn.