Click here to Skip to main content
15,888,454 members
Home / Discussions / C#
   

C#

 
GeneralRe: Linking combo box to list box Pin
kevinrc12-Jun-03 5:07
kevinrc12-Jun-03 5:07 
GeneralRe: Linking combo box to list box Pin
totig12-Jun-03 5:49
totig12-Jun-03 5:49 
GeneralRe: Linking combo box to list box Pin
kevinrc12-Jun-03 6:40
kevinrc12-Jun-03 6:40 
GeneralDatagrid data entry problem in WinForm Pin
Chris#12-Jun-03 3:31
Chris#12-Jun-03 3:31 
GeneralRe: Yes, the NumLock light is on Pin
Chris#12-Jun-03 5:25
Chris#12-Jun-03 5:25 
GeneralRe: Datagrid data entry problem in WinForm Pin
A.Wegierski12-Jun-03 19:50
A.Wegierski12-Jun-03 19:50 
GeneralDatabinder question Pin
Peter Cresswell12-Jun-03 2:36
Peter Cresswell12-Jun-03 2:36 
GeneralMemory leak woes. Pin
EvilDingo12-Jun-03 2:28
EvilDingo12-Jun-03 2:28 
Hey everyone,

I'm still chugging away on my little game. Right now you can connect to a server and play across the internet. The 'game' works, but I'm having some serious issues with memory leaks.

I don't know when I should implement the IDisposable interface. Even when I implement it, it doesn't seem to make any difference at all. It seems the source of my problem are arrays and their values.

For example: I had an array of bullets. Whenever one bullet was spent and no longer being used, I would just simply call: bulletArray[i] = new Bullet(); and replace the old version of the object with a new one. This caused a very unwelcome memory leak that took me hours to track down. I thought I could just overwrite the old object but it turns out the system holds on to it indefinitely.

My next problem. I've recently started using ArrayLists. Whenever something was no longer needed, I would .Remove(ObjectNoLongerNeeded). Wouldn't removing the object also set it up for garbage collection? It doesn't seem to. What do I need to do to get rid of the old object and reclaim the memory?

This is my first C# program and the first time using a OO language. It's wonderful to see my program working, but whenever anyone shoots while connected their program's memory requirement permanently increases. Whenever anyone explodes, memory requirement goes up. I know this has to do with my arrays, but damn, there are so many of them. How can I get around this?

If I have a class called MyClass() that implements IDisposable, what do I need in the Dispose function to actually 'dispose' it? How do you dispose integers, floats, and other primatives?

Thanks,
EvilDingo
GeneralRe: Memory leak woes. Pin
Philip Fitzsimons12-Jun-03 3:34
Philip Fitzsimons12-Jun-03 3:34 
GeneralRe: Memory leak woes. Pin
CBoland12-Jun-03 6:35
CBoland12-Jun-03 6:35 
GeneralRe: Memory leak woes. Pin
totig12-Jun-03 22:17
totig12-Jun-03 22:17 
GeneralCreating an instance of type using string litteral Pin
Venkatraman11-Jun-03 23:42
Venkatraman11-Jun-03 23:42 
GeneralRe: Creating an instance of type using string litteral Pin
Rocky Moore12-Jun-03 0:05
Rocky Moore12-Jun-03 0:05 
GeneralRe: Creating an instance of type using string litteral Pin
shaunAustin12-Jun-03 0:12
shaunAustin12-Jun-03 0:12 
GeneralRe: Creating an instance of type using string litteral Pin
Venkatraman12-Jun-03 0:38
Venkatraman12-Jun-03 0:38 
GeneralRe: Creating an instance of type using string litteral Pin
Kannan Kalyanaraman12-Jun-03 0:12
Kannan Kalyanaraman12-Jun-03 0:12 
GeneralRe: Creating an instance of type using string litteral Pin
Venkatraman12-Jun-03 0:19
Venkatraman12-Jun-03 0:19 
GeneralRe: Creating an instance of type using string litteral Pin
CBoland12-Jun-03 6:43
CBoland12-Jun-03 6:43 
GeneralAbout loading an image from resource... Pin
Weiye Chen11-Jun-03 23:22
Weiye Chen11-Jun-03 23:22 
GeneralRe: About loading an image from resource... Pin
Rocky Moore11-Jun-03 23:52
Rocky Moore11-Jun-03 23:52 
General'System.ObjectDisposedException' Pin
dratti11-Jun-03 19:13
dratti11-Jun-03 19:13 
GeneralRe: 'System.ObjectDisposedException' Pin
shaunAustin11-Jun-03 21:49
shaunAustin11-Jun-03 21:49 
GeneralRe: 'System.ObjectDisposedException' Pin
CBoland12-Jun-03 6:49
CBoland12-Jun-03 6:49 
GeneralInputbox Pin
Nick Seng11-Jun-03 17:22
Nick Seng11-Jun-03 17:22 
GeneralRe: Inputbox Pin
Kannan Kalyanaraman11-Jun-03 18:53
Kannan Kalyanaraman11-Jun-03 18:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.