473,324 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

MALLOC or

hello sir,
plz have patience to read this looooong mail.
i need to design a high speed recording system.
the pci card has a plx chip which provides dma facilty for data
transfer.
for dma i need the source address and the destination address....
i have input audio files (.wav files) i need to read the data from the
files and store the audio data in an buffer.
buffer is malloc(sizeof(audio File)) or virtualalloc(...)

then i give this buffer[0] as the start address for dma transfer.and
the destination address as the plx register offset which is mapped to
a FIFO.from FIFO output goes to analog output where data is recorded.

Now the question is i need the whole of audio data in RAM.
due to performance issues.. i cant fetch from hard disk and start
transfer.
i need data in memory and start transfer... will it hold data upto
1.5GB in RAM ...?
any suggestion is apprecieated..
Jul 22 '05 #1
3 1861
vikram wrote:
hello sir,
plz have patience to read this looooong mail.
i need to design a high speed recording system.
the pci card has a plx chip which provides dma facilty for data
transfer.
for dma i need the source address and the destination address....
i have input audio files (.wav files) i need to read the data from the
files and store the audio data in an buffer.
buffer is malloc(sizeof(audio File)) or virtualalloc(...)

then i give this buffer[0] as the start address for dma transfer.and
the destination address as the plx register offset which is mapped to
a FIFO.from FIFO output goes to analog output where data is recorded.

Now the question is i need the whole of audio data in RAM.
due to performance issues.. i cant fetch from hard disk and start
transfer.
i need data in memory and start transfer... will it hold data upto
1.5GB in RAM ...?
any suggestion is apprecieated..


How much RAM you have is about as platform-specific as it gets.

C++ doesn't place any particular limit on maximum buffer size. With
current technology, 1.5 GB buffers are certainly possible, and probably
not uncommon. You have to find out whether you particular system has
enough RAM.
Jul 22 '05 #2
vikram posted:
hello sir,
plz have patience to read this looooong mail.
i need to design a high speed recording system.
the pci card has a plx chip which provides dma facilty for data
transfer.
for dma i need the source address and the destination address....
i have input audio files (.wav files) i need to read the data from the
files and store the audio data in an buffer.
buffer is malloc(sizeof(audio File)) or virtualalloc(...)

then i give this buffer[0] as the start address for dma transfer.and
the destination address as the plx register offset which is mapped to
a FIFO.from FIFO output goes to analog output where data is recorded.

Now the question is i need the whole of audio data in RAM.
due to performance issues.. i cant fetch from hard disk and start
transfer.
i need data in memory and start transfer... will it hold data upto
1.5GB in RAM ...?
any suggestion is apprecieated..

Stream it from the storage.

For instance, open an MP3 file and play it. Watch the light on your computer
that indicates Hard Disk usage.
-JKop
Jul 22 '05 #3

"vikram" <vi******@yahoo.co.uk> wrote in message
news:80**************************@posting.google.c om...
hello sir,
plz have patience to read this looooong mail.
i need to design a high speed recording system.
the pci card has a plx chip which provides dma facilty for data
transfer.
for dma i need the source address and the destination address....
Not only that but the PLX chip needs physical rather than virtual
addresses.
i have input audio files (.wav files) i need to read the data from the
files and store the audio data in an buffer.
buffer is malloc(sizeof(audio File)) or virtualalloc(...)
virtualalloc(...) isn't a standard C++ function, I assume you are
programming on a Win32 platform?

On a Win32 system malloc() and VirtualAlloc() return virtual rather than
physical addresses. But that is only one problem. On systems with virtual
memory (like Windows) there is no guarantee that the memory you allocate is
backed by physical RAM memory, it may be on the hard disk or not even
committed at all. In other words even if malloc() succeeds the allocated
memory may not be accessible by the PLX.

To control the PLX chip you will need to write a device driver or use a
toolkit that allows you to access hardware and allocate physical RAM from a
user mode program.
then i give this buffer[0] as the start address for dma transfer.and
the destination address as the plx register offset which is mapped to
a FIFO.from FIFO output goes to analog output where data is recorded.

Now the question is i need the whole of audio data in RAM.
due to performance issues.. i cant fetch from hard disk and start
transfer.
Are you sure there is a performance issue? Normally the speed of a hard
disks is more than adequate for audio applications. If made audio and video
applications in the past and certainly for for audio applications the speed
of the harddisk has never been an issue.
i need data in memory and start transfer... will it hold data upto
1.5GB in RAM ...?
This obviously depends on how much RAM is in your system. Also some concern
is if your PLX chip supports scatter/gatter lists (the old PLX chips didn't
allow scatter/gatter lists on the PCI side of the bridge), otherwise the
physical RAM needs to be contiguous as well...
any suggestion is apprecieated..


This question has nothing to do with the C++ language (the topic of this
newsgroup). I suggest you read this first:
http://www.slack.net/~shiva/welcome.txt and then visit one of the newsgroup
dedicated to the OS you are using.

--
Peter van Merkerk
peter.van.merkerk(at)dse.nl

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: john smith | last post by:
Can someone please explain to me what is happening when I do a malloc(0). This is what I did. int* p = (int*)malloc(0); Then I printed the value of p and of course it was non-null. But...
34
by: Richard Hunt | last post by:
I'm sorry for asking such a silly question, but I can't quite get my head around malloc. Using gcc I have always programmed in a lax C/C++ hybrid (which I suppose is actually c++). But I have...
231
by: Brian Blais | last post by:
Hello, I saw on a couple of recent posts people saying that casting the return value of malloc is bad, like: d=(double *) malloc(50*sizeof(double)); why is this bad? I had always thought...
7
by: Rano | last post by:
/* Hello, I've got some troubles with a stupid program... In fact, I just start with the C language and sometime I don't understand how I really have to use malloc. I've readden the FAQ...
20
by: spasmous | last post by:
main() { float * f; initialize_f(f); // ...use f for processing free(f); }
15
by: Martin Jørgensen | last post by:
Hi, I have a (bigger) program with about 15-30 malloc's in it (too big to post it here)... The last thing I tried today was to add yet another malloc **two_dimensional_data. But I found out that...
68
by: James Dow Allen | last post by:
The gcc compiler treats malloc() specially! I have no particular question, but it might be fun to hear from anyone who knows about gcc's special behavior. Some may find this post interesting;...
40
by: Why Tea | last post by:
What happens to the pointer below? SomeStruct *p; p = malloc(100*sizeof(SomeStruct)); /* without a cast */ return((void *)(p+1)); /* will the returned pointer point to the 2nd...
71
by: desktop | last post by:
I have read in Bjarne Stroustrup that using malloc and free should be avoided in C++ because they deal with uninitialized memory and one should instead use new and delete. But why is that a...
23
by: raphfrk | last post by:
I am having an issue with malloc and gcc. Is there something wrong with my code or is this a compiler bug ? I am running this program: #include <stdio.h> #include <stdlib.h> typedef...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.