Game Maker Community YoYo Games

Welcome Guest ( Log In | Register )

6 Pages V   1 2 3 > »   
Reply to this topicStart new topic
Cleanmem - The First Memory Cleaning Dll (update!), From 500,000kb down to 2,000kb!
halo shg
post Jun 30 2009, 07:14 PM
Post #1


Programmer
Group Icon

Group: GMC Member
Posts: 543
Joined: 29-December 06
From: Ontario, Canada
Member No.: 67113



CleanMemV2.0
By Halo Shg




Information:
If you've ever found your game lagging or consuming too much memory, you're in the right place.
Finally, a perfect solution to bring down the memory consumption!

Functions:
  • cleanmem_init
  • cleanmem
  • cleanmem_get_mem

Special Notes:
You should probably call this on room change and game end. More won't do any harm, but it wouldn't really be necessary.
This DLL is only 4.5kb in size.

UPDATE: Now you can get the amount of memory your game is using! That means you can clean when it gets above a certain point! - Thanks GMLismybeach for the suggestion


Legal Information And Licensing
Ok, so a lot of people have been asking me about this (both here and in PM's). I figured I'd better put up some info.
QUOTE
You MAY use this in a freeware application freely.
You MAY use this in a shareware application freely.
You MAY use this in a commercial application freely as long as I am credited somewhere in the application.
You MAY NOT modify the executable WITHOUT crediting me for the original.
You MAY request the source.

For any uses other than commercial (ie. shareware, freeware) crediting is optional. For commercial games, credit is required.
If you would like a version with no information (this is, my name is not stamped on the DLL), you may request it.
Keep in mind, however, that credit is required for ALL types of applications if you are using this version.

If have any special requests, PM Me.

Examples:
You have a freeware application and the DLL is the original (unmodified) copy.
  • Credit: Optional

You have a freeware application and you have modified or requested the NoInfo version of the DLL.
  • Credit: Required

You have a commercial application (regardless of the DLL type)
  • Credit: Required

You have requested/disassembled the source, and are distributing a modified version either in your application or
standalone.
  • Credit: Same rules apply for applications. If the DLL contains still my name (in the object (compiled) form, that is)
    then credit is optional.




Download:
Direct Link (Right Click > Save As)
Old V1

Mirror 1
Mirror 2


This post has been edited by halo shg: Nov 3 2009, 11:41 PM
Go to the top of the page
 
+Quote Post
Sindarin
post Jun 30 2009, 07:49 PM
Post #2


Indie Game Developer
Group Icon

Group: GMC Member
Posts: 1628
Joined: 1-April 04
From: Athens, Greece
Member No.: 7742



Nice work!
As I have already made something similar for my games I'd say it would be safe to free the memory every 50 steps (don't use it in a Step event, leave some interval between).
Just DON'T free the memory when you're e.g. creating, replacing a sprite, background, sound or freeing them. (Should make sense)
I wonder why Game Maker doesn't have an inbuilt function for this?

This post has been edited by Sindarin: Jun 30 2009, 07:50 PM
Go to the top of the page
 
+Quote Post
TheMagicNumber
post Jun 30 2009, 08:13 PM
Post #3


GMC Member
Group Icon

Group: GMC Member
Posts: 3835
Joined: 9-December 07
Member No.: 94888



Well, I did give it a try, and watched the memory usage in Process Explorer. It didn't work. sad.gif The memory usage just stopped increasing (didn't make any more images). Now I have a huge memory leak and need to restart. tongue.gif

Maybe it's the example?

Windows XP SP3, Intel P4 1.7GHz (32 bit)
Go to the top of the page
 
+Quote Post
Whaddsoft
post Jun 30 2009, 08:27 PM
Post #4


wademcgillis.com
Group Icon

Group: GMC Member
Posts: 967
Joined: 25-December 04
From: GMT-5
Member No.: 18655



QUOTE (GMREC1111 @ Jun 30 2009, 04:13 PM) *
Now I have a huge memory leak and need to restart. tongue.gif

Wait, the memory doesn't automatically free when a program closes?
Go to the top of the page
 
+Quote Post
score_under
post Jun 30 2009, 08:49 PM
Post #5


GMC Member
Group Icon

Group: GMC Member
Posts: 1021
Joined: 2-March 04
From: ./UK/England/
Member No.: 6620



BUG: You don't close your process handle after you open it.
Go to the top of the page
 
+Quote Post
halo shg
post Jun 30 2009, 08:57 PM
Post #6


Programmer
Group Icon

Group: GMC Member
Posts: 543
Joined: 29-December 06
From: Ontario, Canada
Member No.: 67113



That's strange. I had no problems testing it on multiple computers running multiple operating systems.

EDIT:
QUOTE
BUG: You don't close your process handle after you open it.

Fixed. Redownload.

This post has been edited by halo shg: Jul 1 2009, 03:24 PM
Go to the top of the page
 
+Quote Post
TheMagicNumber
post Jun 30 2009, 09:14 PM
Post #7


GMC Member
Group Icon

Group: GMC Member
Posts: 3835
Joined: 9-December 07
Member No.: 94888



Debug version returned zero, and still didn't clear any memory.
CM.exe is complete rubbish, it seems to be corrupt, and I can't delete it...thanks for the Trojan, removed.

This post has been edited by GMREC1111: Jun 30 2009, 09:15 PM
Go to the top of the page
 
+Quote Post
halo shg
post Jun 30 2009, 09:28 PM
Post #8


Programmer
Group Icon

Group: GMC Member
Posts: 543
Joined: 29-December 06
From: Ontario, Canada
Member No.: 67113



EDIT:
Post removed.

You can still get PcWinTech's memory cleaning tool from PcWinTech.com

This post has been edited by halo shg: Nov 10 2009, 09:31 PM
Go to the top of the page
 
+Quote Post
TheMagicNumber
post Jun 30 2009, 09:35 PM
Post #9


GMC Member
Group Icon

Group: GMC Member
Posts: 3835
Joined: 9-December 07
Member No.: 94888



It is still failing, no changes are detected in Process Explorer (excluding the stopping of allocating memory). Basically it doesn't show a decline, but it did in fact update.
Go to the top of the page
 
+Quote Post
HaRRiKiRi
post Jul 1 2009, 07:31 AM
Post #10


GMC Member
Group Icon

Group: GMC Member
Posts: 1196
Joined: 30-November 03
Member No.: 2861



It works perfectly for me (win xp 32bit sp3). It increases the load when run and when I press space the mem usage drops down to about 2,000K (from 35,000 or even 50,000). So it works nicely. smile.gif
Go to the top of the page
 
+Quote Post
smart_monkey
post Jul 1 2009, 08:40 AM
Post #11


GMC Member
Group Icon

Group: GMC Member
Posts: 100
Joined: 27-September 08
From: Australia GMT+9:30
Member No.: 115517



I haven't yet tried it but is very interesting. This would be a tool for anyone with a game that drains tons of memory.

Downloading now!
Go to the top of the page
 
+Quote Post
halo shg
post Jul 1 2009, 03:42 PM
Post #12


Programmer
Group Icon

Group: GMC Member
Posts: 543
Joined: 29-December 06
From: Ontario, Canada
Member No.: 67113



@Sindarin - I too wonder why it isn't built in. It was only like 5 lines of code. tongue.gif

@GMREC1111 - I think I may have found the problem. You said you were using Process Explorer, so I assume you were looking at Virtual Size,
instead of Working Set. Basically, your looking at the amount allocated memory, not memory usage.

You can toggle that column, or use Windows XP's task manager by typing taskmgr.exe into the run dialog

@HaRRiKiRi - Thank you for confirming that it works on SP3. Thanks for testing it aswell.

@smart_monkey - I'd be happy to hear your response smile.gif


~ Halo Shg
Go to the top of the page
 
+Quote Post
TheMagicNumber
post Jul 1 2009, 04:33 PM
Post #13


GMC Member
Group Icon

Group: GMC Member
Posts: 3835
Joined: 9-December 07
Member No.: 94888



QUOTE (halo shg @ Jul 1 2009, 11:42 AM) *
@GMREC1111 - I think I may have found the problem. You said you were using Process Explorer, so I assume you were looking at Virtual Size,
instead of Working Set. Basically, your looking at the amount allocated memory, not memory usage.

Okay, I guess it works. But it's not freeing allocated memory. If I read correctly. tongue.gif
Go to the top of the page
 
+Quote Post
prog
post Jul 1 2009, 07:23 PM
Post #14


GMC Member
Group Icon

Group: GMC Member
Posts: 996
Joined: 21-March 09
Member No.: 130325



This really helps with my 3D game. (With this, it actually goes above 10 fps on my crappy computer)!
Go to the top of the page
 
+Quote Post
Meiun
post Jul 1 2009, 09:12 PM
Post #15


GMC Member
Group Icon

Group: GMC Member
Posts: 248
Joined: 9-November 03
From: New Hampshire
Member No.: 1849



Just tried it on Vista 64 bit, and seems to work fine. As useful as this does seem, would you mind adding a description of how exactly this works and what it is that it is doing to free the memory?
Go to the top of the page
 
+Quote Post
uuf6429
post Jul 1 2009, 09:37 PM
Post #16


Covac Software
Group Icon

Group: GMC Member
Posts: 2715
Joined: 3-July 06
From: Gozo, Malta, Europe
Member No.: 53953



Actually it may be the second such dll wink1.gif. However, nice you got it published...unlike someone else. Quite stable too...
Go to the top of the page
 
+Quote Post
IceMetalPunk
post Jul 1 2009, 09:53 PM
Post #17


Rocker
Group Icon

Group: GMC Member
Posts: 3933
Joined: 12-March 04
From: USA
Member No.: 6970



Very nice. At first I thought it would mess with loaded resources or some such nonsense, but I underestimated you. A quick test (saving the created sprites to a ds_list and drawing them all every step) shows the resources are fine and the memory still drops incredibly!

Very nice. I need to go check out how much memory Blastix is using (never did, ironically), and if it's a large amount, I'll definitely use this DLL.

-IMP wink1.gif smile.gif

*EDIT* Well, the test was a success. Blastix was hogging almost 100,000 KB of RAM, then I used your DLL and called it every time the room changes, and it knocked down to only 7KB. Amazing. I'll be using this.

This post has been edited by IceMetalPunk: Jul 1 2009, 10:00 PM
Go to the top of the page
 
+Quote Post
halo shg
post Jul 2 2009, 01:54 AM
Post #18


Programmer
Group Icon

Group: GMC Member
Posts: 543
Joined: 29-December 06
From: Ontario, Canada
Member No.: 67113



@GMREC1111 - I'm not sure if this is possible. Even all the commercial memory cleaners I've tried fail to do this. Makes me think it isn't possible.

@prog - Glad you liked it. smile.gif

@Meiun - Of course. Using an API call, I am able to remove pages from the working set (Google it). First, however, I must register this DLL as a "debugger" to avoid denial of access. If you want the (C++) source, PM me. I would be happy to give it to you. I'm not sure if I'd like to release it to public yet though.

@uuf6429 - Well, OK. Mines publicly available tongue.gif

@IceMetalPunk - laugh.gif Windows doesn't fail that badly. Also, I sure hope you meant 7,000KB. Otherwise I might assume performance-enhancing drugs were involved tongue.gif


On a final note, happy Canada Day to all! And in case I forget, happy early Independence Day!

~ Halo Shg
Go to the top of the page
 
+Quote Post
Krisando
post Jul 2 2009, 02:28 AM
Post #19


GMC Member
Group Icon

Group: GMC Member
Posts: 1311
Joined: 17-August 04
From: New Zealand
Member No.: 13059



Wow worked great.
Go to the top of the page
 
+Quote Post
prog
post Jul 2 2009, 02:32 AM
Post #20


GMC Member
Group Icon

Group: GMC Member
Posts: 996
Joined: 21-March 09
Member No.: 130325



What exactly does this do?
Go to the top of the page
 
+Quote Post

6 Pages V   1 2 3 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 9th February 2010 - 05:20 PM