我的电脑配置是“晒羊”700  128m内存。
  用win2000,在作稍大一点的程序时就出现内存不足的提示!
  请问该如何优化能使内存占用少一点点,系统运行快一点点。谢谢!
 

解决方案 »

  1.   

    不对,不是delph 程序的问题
    我编过见过的程序
    不建窗体
    8k 文件大小用KOL
    24k 文件大小
    最小800k内存用Delphi 的 Vcl
    300~1700k文件大小
    用1.3~6兆内存
      

  2.   

    没有说吃得完128m内存的。到是Delphi 6本身最小用39兆内存,
    如果再加上Win 2000本身用掉的60~90兆内存,你就没有物理内存了。
    应该是你的页面文件不够大,在我的电脑|属性|高级|性能选项里设置
    至少在256兆,关掉不必要的程序和窗口,系统服务还不行重装。
      

  3.   


    一:实现控件面板的平滑滚动:
    安装过许多控件的朋友都知道,在众多的控件中选择一个实在不是一件轻松的事,鼠标要不停点击,如果能平滑滚动该多好啊,好在borland的专家早就想到了这一点:
    建立一个文本文件,内容为:
    REGEDIT4
    [hkey_current_user\software\borland\delphi\5.0\extras]
    "autopaletteselect"="1"
    "autopalettescroll"="1"
    保存为tip.reg,然后双击此文件,启动delphi,怎么样?是不是爽多了!
    二:加快程序启动速度:
    delphi启动确实有点慢,既要显示快闪屏幕,又要读注册表设置,对于配置低的机器简直是一种折磨,实际上我们完全可以通过启动参数来控制它:
    建立一个快捷方式,目标为:d:\delphi5\delphi5\bin\delphi32.exe /ns /np
    (我的delphi装在d:\delphi5目录下,你要做相应改变。)
    ns:no splash 不显示快闪屏幕
    np:no project不加载项目
    三.观察内存堆分配情况:
    同上,快捷方式目标为:d:\delphi5\delphi5\bin\delphi32.exe /hm /hv 
    此后每启动此快捷方式就可看到delphi标题栏上不停变化的堆分配字节数
    四.在右键快捷菜单中增加编译及查看功能:
    先为dpr文件增加功能:
    建立一个文本文件,内容为:
    regedit4
    [hkey_classes_root\delphiproject]
    @="delphi project"
    "editflags"=hex:00,00,00,00
    "alwaysshowext"=""
    [hkey_classes_root\delphiproject\defaulticon]
    @="d:\\delphi5\\delphi5\\bin\\delphi32.exe, 4"
    [hkey_classes_root\delphiproject\shell]
    @=""
    [hkey_classes_root\delphiproject\shell\open]
    @="&open"
    "editflags"=hex:01,00,00,00
    [hkey_classes_root\delphiproject\shell\open\command]
    @="d:\\delphi5\\delphi5\\bin\\delphi32.exe /ns %1"
    [hkey_classes_root\delphiproject\shell\open\ddeexec]
    @="[open(\"%1\")]"
    [hkey_classes_root\delphiproject\shell\open\ddeexec\application]
    @="delphi32"
    [hkey_classes_root\delphiproject\shell\autobuild]
    "editflags"=hex:01,00,00,00
    [hkey_classes_root\delphiproject\shell\autobuild\command]
    @="d:\\delphi5\\delphi5\\bin\\delphi32.exe /ns %1 /b"
    [hkey_classes_root\delphiproject\quickview]
    @="*"
    存为delphiproject.reg,然后双击此文件,以后你就可以在以dpr为后缀的项目文件的右键快捷菜单中发现多了autobuild一项,可以马上编译生成可执行文件了,还多了快速查看一项,可以不打开delphi而察看文件内容。
    再为pas文件增加功能:
    建立一个文本文件,内容为:
    regedit4
    [hkey_classes_root\delphiunit]
    @="delphi source file"
    "editflags"=hex:00,00,00,00
    "alwaysshowext"=""
    [hkey_classes_root\delphiunit\defaulticon]
    @="d:\\delphi5\\delphi5\\bin\\delphi32.exe,5"
    [hkey_classes_root\delphiunit\shell]
    @=""
    [hkey_classes_root\delphiunit\shell\open]
    @="&open"
    [hkey_classes_root\delphiunit\shell\open\command]
    @="d:\\delphi5\\delphi5\\bin\\delphi32.exe /ns /np"
    [hkey_classes_root\delphiunit\shell\open\ddeexec]
    @="[open(\"%1\")]"
    [hkey_classes_root\delphiunit\shell\open\ddeexec\application]
    @="delphi32"
    [hkey_classes_root\delphiunit\shell\compile]
    "editflags"=hex:01,00,00,00
    [hkey_classes_root\delphiunit\shell\compile\command]
    @="d:\\delphi5\\delphi5\\bin\\dcc32.exe %1"
    [hkey_classes_root\delphiunit\quickview]
    @="*"
    存为delphiunit.reg, 然后双击此文件,以后你就可以在以pas为后缀的源码文件的右键快捷菜单中发现多了compile一项,可以马上编译生成dcu文件了,还多了快速查看一项,可以不打开delphi而察看文件内容。
    要注意你的delphi安装路径要做相应更改,对注册表不熟悉的朋友一定要谨慎做好备份。
      

  4.   

    去掉不必要的VCL控件,DELPHI会轻松许多!!!
      

  5.   

    to(丑丑)
      我照着做了,可是加“/ns /np”的快结方式怎么创建不了。
    还有“右键快捷菜单中增加编译及查看功能”的代码保存成".reg"后执行出现误。
    请确认一下代码,谢谢。
    (我的路径是:C:\Program Files\Borland\Delphi6
     我将代码中出现的路径都替换了,还需要改什么吗?)
      

  6.   

    快结方式怎么创建不了??不会吧,点即鼠标右键就可以新建快捷方式建立快捷方式的目标为:C:\Program Files\Borland\Delphi6\bin\delphi32.exe /ns /np
    注册表是对win98的,你的系统是win2k的吧??改成2k的格式就可以了!