Skip to main content
gamedev.net
🔒 Locked

Memory Problem

Started by alaa_m 1 reply 350+ views
Original Post
alaa_m
alaa_m
Hi, I have a memory problem. My program sends DirectShow media samples throu DirectPlay to another program on a remote machine, the size of each media sample after compression is about 90 KB. My program send new samples very frequently (when i run the graph). I noticed that my program endup using all of the system memory 256MB in less than 20 seconds, and then starts using virtual memory. I tried the DPNSEND_NOCOPY flag in the SendTo() function, but that didn''t work. Ofcourse I can''t deallocate any memory since the media sample buffer comes from my DirectShow filter which passes it on to downstream filters. What I think is happening is that DirectPlay allocates buffer for the media sample its gonna send, and since new buffers are sent very frequently while DirectPlay is still dealing with previous buffers, the allocated memory is much bigger than the deallocated memory. I notices that my program''s memory usage is increased by about 5 MB every , say, 0.5 sec. Ofcource mayb more than 5 or 10 media samples are produced in a sec. I tried using SendTo() synchronously. This causes my Transform() method in my DirectShow filter to block until the current media sample is sent. So i assumed that the allocation & deallocation rate is the same. But i noticed that my program''s mem usage is still increasing, offcourse not as before when SendTo() was asynchronously. The mem usage is now increasing about 500 K every , say, 0.5 sec. This is good, i mean from 5 MB to 500 K, very good. But this will not be good after some time, cuz the whole memory will be allocated after some time. Any ideas will be really appreciated. Thanks alot in advance. Alaa,
Alaa,
niyaw
niyaw
try using winsock and sending samples via sendto(). dplay overhead may as well be killing you.
alaa_m
alaa_m
Well I am heavily relying on DirectPlay not just for video transmission, so a change like this isn''t trivial. Besides, I have no expereince in winsock at all!

Other ideas?!

Alaa,
Alaa,

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.