|
Try use GlobalAlloc with GMEM_MOVEABLE flag, this may be work fast.
|
|
|
|
|
Hi,
I've read that the GlobalAlloc-Function-Group come from the Win 3.x-Framework.
What's the difference between GlobalAlloc and VirtualAlloc?
triathlet394
|
|
|
|
|
Yes, you right, GlobalAlloc come from Win3.x, but hi work with whole address space, and if you have 256M free in phisical memory, hi get you memory block in phisic memory .
And if you use VirtualAlloc function, you mast manage usage of pages.
About speed : GlobalAlloc work some slower then VirtualAlloc, but i didn't think, that is critical (for 256M on Win2k diference less 1s).
|
|
|
|
|
For what complier/C library? malloc/free is not provided by any OS I'm aware of. Instead your C library (which might come with the compiler, might be included) provides it.
In some Unix systems (and I suspect Windows as well), the library asks the OS for more memory than you requested, and then holds that in a buffer. If you malloc more, it will give you memroy from that same buffer if there is room. When you free the memory it marks it unused, but doesn't return it to the OS, instead it will hold onto it in case you need more memory latter.
On many systems the OS will only allow you to allocate 4Kb chunks (this varies depending on both the OS and the design of the hardware). The library is designed so that you can malloc a few bytes, without getting a full 4kb.
Also, in many cases the library will write something to most of that memory when it is allocated. The OS however may just mark your application as allowed to use that much memory, but not actually give it to you, until you use it.
In effect it is optimized for small accesses, and you are sending it a large acccess which it isn't designed for.
If you don't need portability you might be able to speed things up by using OS specific functions to get the memory from the OS yourself.
Note that none of this will help if you don't have enough physical memory. If you want to use 256M of memory you should have at least 400M of physical memory so the OS doesn't have page everything else out.
|
|
|
|
|
Hi there,
How do I change the baudrate of an already opened serial port. I'm pretty sure this should be possible, since I'm about to implement an IEC standard where this behavior is a planned feature.
I'm using the plain VC++ WinAPI what I tried was:
DCB dcb;
GetCommState(m_hFile, &dcb);
dcb.BaudRate = CBR_9600; SetCommState(m_hFile, &dcb);
I get no errors on these opeations, however the connected modem seems simply to time out, I get no more answers from it.
|
|
|
|
|
I am not familiar with the WinAPI, but you need to put the modem in "command mode" to set modem parameters. Than switch back to communication / operating mode.
Vaclav
|
|
|
|
|
Ok,
do you know the Hayes code (the modem command set) to change the Baudrate?
|
|
|
|
|
I'm creating a wav player and am making use of PlaySound(). Can u please recommend whether to use MCI or continue with the same.. also i need to create a simple bar visualization like the one in winamp.. THANKS!
[edit] how can i play mp3 files in my program?
|
|
|
|
|
I've seen some articles here on design patterns, but nothing that looks down to my speed. I would like to learn about design patterns, but actually know nothing about them. Does anyone have any suggestions on where I could start?
[insert witty comment here]
bdiamond
|
|
|
|
|
I know nothing about this, but "fractals" come to mind.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Huh?
[insert witty comment here]
bdiamond
|
|
|
|
|
http://dictionary.reference.com/search?q=fractal
http://members.tripod.com/haunt13/fractal.html
http://www.programmersheaven.com/zone10/cat101/
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanks, I'll look into those!
A brave person isn't always necessarily a smart person
bdiamond
|
|
|
|
|
Sorry, I think you misunderstood my question. I'm not talking about graphics. I mean design patterns as in 'singleton' pattern; applying patterns to frequently encountered programming problems or situations, if I understand the concept correctly.
[A brave person isn't always necessarily a smart person]
bdiamond
|
|
|
|
|
bdiamond wrote:
Sorry, I think you misunderstood my question.
Like I said, I know nothing about this.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
This book will help: <http://www.amazon.com/exec/obidos/tg/detail/-/0201633612/103-7334348-8442222?v=glance>
Hua-Ying
|
|
|
|
|
what book?
[A brave person isn't always necessarily a smart person]
bdiamond
|
|
|
|
|
There are some good books on Design Patterns
Design Patterns - Addison Wesley - Gamma, Helm, Johnson, Vlissides
is one I would recommend.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
thanks!! that's what I was looking for!
[A brave person isn't always necessarily a smart person]
bdiamond
|
|
|
|
|
|
thank you!
[A brave person isn't always necessarily a smart person]
bdiamond
|
|
|
|
|
I haven't read the "bible" on Design Patterns, i.e., the book by Gamma et al. However, I think you'll find Design Patterns Explained far more readable and accessible. The good thing about it is that it is problem-based, i.e., it first describes what the problem situation is and then moves step by step to design patterns.
Kevin
|
|
|
|
|
The classic Design Patterns book is "Design Patterns" by Gamma, Helm, Johnson, and Vlissides. Addison Wesley.
|
|
|
|
|
As others have said: "Design Patterns" by Gamma, Helm, Johnson, and Vlissides. Addison Wesley. It is the classic. It WILL end up on your bookshelf (unless something changes programing drasticly in the very near future), so if you don't buy it now, at least start planning on buying it.
Go to your local bookstore. There are several books on the subject, some of which are an easier read than the above. I started with Design Patterns Explained (I don't recall who wrote it, and I might have the tittle a little wrong), which is an easier introduction. There are others, take your pick.
I havn't found a website that is as good as books in this case. Perhaps because design patterns are basicly enough, and change so little, that books can cover them.
|
|
|
|
|
hi!!!
i'm just a beginer and doing F.Y MCS..we have a project submission as a partof our curriculum. and i'm trying to make a media player.. i'am using MCI interface.. can u help me with some suggestions? like i wanted to playback mp3 files and include some visualization.. Thanks
Vijayalakshmi Iyer
|
|
|
|