CAFE

Delphi 관련 팁

insufficient disk space 라는 오류발생

작성자tkdsong|작성시간10.11.30|조회수3,895 목록 댓글 0

[답변]] insufficient disk space 라는 오류발생
..
(손님)
2004-11-22 오후 4:33:06
1239회 조회


  
  
찜이야 wrote:
> 혹시 이와 같은 에러를 보신분 있으신가요??
> 대충 살펴보니 BDE 관련 해서 스왑 형식으로 생기는 파일 이라던데
> 해결 방법을 아시는분???
> 심심하다 싶으면 한번씩 나오네요 에러 메세지가...
>
> 현재 3tier 환경에 오라클 델파이 7.0 사용 중입니다.
>
> 혹시라도 아시는분은 답변 달아 주시면 감사 하겠습니다.

혹시 하드디스크가 정확하게 4GB정도 남아있지않나요?.
그리고 OS는 WIN2000에서 실행하지않았나요..?..
저는 그런 경우에 겪은 경험입니다.

WIN2000일경우초기 DB접속후 Query문 발생시
"insufficient disk space .. 'c:\document and settings\administrator\local Settings\inmem000.rem' " 경고문구발생됨

아무래도 델파이 버그인것 같습니다.
제가 힘이없어서 볼랜드사에 연락은 할수없고.
구글사이트에서 디져서리 해결책을 찾았습니다.
그럼 저와같은 경험을 하지않으시길 바래요. (전 3일을 전전긍긍했으니깐요)

아래파일을 문제되는 프로그램에 함께사용하세요.
그럼 좋은해결책이 되셨기를 바래요.

//////////////////////////////////////////////////////////////////////////////////////
//
// ----- BDE 4GB PATCH -----
// Version 1.01
//
//
//
// FUNCTION
//
// This unit is a patch for the famous 4Gb BDE Bug. It is build to fix the
// 'Insufficient disk space'-error which can occur while using BDE when
// the disk free space is near to a multiple of 4Gb. For more information
// please see BDE report# 7089 on Quality Central.
//
// TECH DETAILS
//
// The reason for the error in BDE is aparently a bug in idapi32.dll while
// computing free disk space. Idapi32.dll is using the api function called
// GetDiskFreeSpaceA exported by kernel32.dll.
// The solution is to 'patch' GetDiskFreeSpaceA in kernel32.dll for the current
// process, every call to this function is redirected to a new routine
// (NewGetDiskFreeSpaceA).
//
// USAGE
//
// Just include this unit in your at the top of the uses clause in your project.
//
//
// 2004-02-26
// (c) Reinaldo Roberto Ya?z Arrey
// Buenos Aires, Argentina
// ryaayr@yahoo.com, ryaayr@arnet.com.ar
// Any feedback is welcome!
//
// Disclaimer:
// The code and text in this unit are not associated with Borland. This unit is
// provided "as is"! The author takes no responsibility for use, or misuse, of
// this unit. Usage of this code is at your own risk.
// License:
// You are free to use this unit in any way, but beware that BDE is an
// official Borland product, and therefore bound by the terms and conditions of
// the Borland product license.
//
//////////////////////////////////////////////////////////////////////////////////////
// Thanks to:
// Leonardo Mato & Manuel E. Parma
// for their encouragement to produce good code.
//////////////////////////////////////////////////////////////////////////////////////
//
// History: 2004-03-05 Version 1.01 (Fixes a problem on finalization if using packages)
// 2004-02-26 Version 1.00 (Created)
//
//////////////////////////////////////////////////////////////////////////////////////

unit FixBDE4GbBug;

interface

procedure PatchBDE;

implementation

uses Windows;


type
TRYPatch = record
OrgAddr: Pointer;
OrgBytes: array[0..4] of Byte;
end;

// Este metodo nunca lo vi escrito correctamente para contemplar los casos de
// usar packages o no.
// Si se utilizan packages HAY que preguntar por el $25FF y patchear el puntero a
// puntero a puntero
// Sino, no se patchea absolutamente nada !!!!
// Ry@2003.10.31

function NotNT: boolean; //jmck
var
EnvVar: string;
OSStr: array[0..127] of char;
n: integer;
begin
Result := FALSE;
EnvVar := 'OS';
n := GetEnvironmentVariable(PCHar(EnvVar), @OSStr, 128);
EnvVar := SysUtils.StrPas(OSStr);
Result := Pos('NT', EnvVar) = 0;
end;

function RedirectByRY(OldPtr, NewPtr: Pointer): TRYPatch;
type
PPtr=^pointer;
PPPtr=^PPtr;
TByteArray=array[0..maxint-1] of byte;
PByteArray=^TByteArray;
var
OldProtect,
Protect : DWORD;
p: PByteArray;
begin
if PWord(OldPtr)^ = $25FF then
begin {Es un JMP DWORD PTR [XXXXXXX](=> Esta utilizando Packages)}
p := OldPtr;
OldPtr := (PPPtr(@p[2])^)^;
end;
VirtualProtect(OldPtr, 5, PAGE_READWRITE, @OldProtect);
result.OrgAddr := OldPtr;
result.OrgBytes[0] := PByte(OldPtr)^;
result.OrgBytes[1] := PByte(Integer(OldPtr) + 1)^;
result.OrgBytes[2] := PByte(Integer(OldPtr) + 2)^;
result.OrgBytes[3] := PByte(Integer(OldPtr) + 3)^;
result.OrgBytes[4] := PByte(Integer(OldPtr) + 4)^;

PByte(OldPtr)^:= $E9;
PInteger(Integer(OldPtr)+1)^ := Integer(NewPtr) - Integer(OldPtr) - 5;
VirtualProtect(OldPtr, 5, OldProtect, @Protect);
FlushInstructionCache(GetCurrentProcess, OldPtr, 5);
end;

procedure RestorePatch(RestorePatch: TRYPatch);
var
OldProtect,
Protect : DWORD;
OldPtr: Pointer;
begin
OldPtr := RestorePatch.OrgAddr;
VirtualProtect(OldPtr, 5, PAGE_READWRITE, @OldProtect);
PByte(OldPtr)^ := RestorePatch.OrgBytes[0];
PByte(Integer(OldPtr) + 1)^ := RestorePatch.OrgBytes[1];
PByte(Integer(OldPtr) + 2)^ := RestorePatch.OrgBytes[2];
PByte(Integer(OldPtr) + 3)^ := RestorePatch.OrgBytes[3];
PByte(Integer(OldPtr) + 4)^ := RestorePatch.OrgBytes[4];
VirtualProtect(OldPtr, 5, OldProtect, @Protect);
FlushInstructionCache(GetCurrentProcess, OldPtr, 5);
end;


function NewGetDiskFreeSpaceA(lpPath: LPCTSTR; lpSectorsPerCluster: LPDWORD
; lpBytesPerSector: LPDWORD; lpNoFreeClusters: LPDWORD;
lpTotalNoClusters: LPDWORD): LongBool; stdcall;
var
FreeBytesAvailableToCaller, TotalNoBytes,
TotalNoFreeBytes: ULARGE_INTEGER;

PFreeBytesAvailableToCaller, PTotalBytes,
PTotalFreeBytes: PLargeInteger;
begin
PFreeBytesAvailableToCaller := @FreeBytesAvailableToCaller;
PTotalBytes := @TotalNoBytes;
PTotalFreeBytes := @TotalNoFreeBytes;

result := GetDiskFreeSpaceEx(lpPath,
PFreeBytesAvailableToCaller,
PTotalBytes, PTotalFreeBytes);
if not result then Exit;

lpSectorsPerCluster^ := 1;
lpBytesPerSector^ := 1;

if (FreeBytesAvailableToCaller.QuadPart > $ffffffff) then
lpNoFreeClusters^ := $ffffffff
else
lpNoFreeClusters^ := FreeBytesAvailableToCaller.QuadPart;
lpTotalNoClusters^ := $ffffffff;
end;


var
kernel32: HMODULE;
ProcAddr: Pointer;
RestoreP: TRYPatch;

procedure PatchBDE;
begin
if notNT then Exit;
kernel32 := LoadLibrary('kernel32');
ProcAddr := GetProcAddress(kernel32, 'GetDiskFreeSpaceA');
RestoreP := RedirectByRy(ProcAddr, @NewGetDiskFreeSpaceA);
end;

procedure UnPatchDBE;
begin
{Leave everything as before, just in case...}
if notNT then Exit;
RestorePatch(RestoreP);
FreeLibrary(kernel32);
end;


initialization
PatchBDE;

finalization
UnPatchDBE;

end.

 
저도 방금 똑같은 문제가 생겨서 이것저것 해보다가 해결했습니다.

원인은 OS 가용 가상메모리가 가득차서 그런것 같습니다.

저같은 경우 보조프로그램=>시스템도구 => 디스크 정리에서 임시파일을 모두 지웠구요

내컴퓨터 속성 = > 고급 =>(성능)설정 => 고급 => 가상 메모리 변경 에서 메모리

크기를 늘려 줬더니 정상적으로 돌아 가더군요...

이것 때문에 나으 소중한 시간을 30분이나 썼습니다 .. ㅜㅜ

참고하세요 ^,.a^


 

 
 출처 : http://www.delmadang.com/community/bbs_view.asp?bbsNo=17&bbsCat=0&st=C&keyword=insufficient%20disk%20space&indx=377241&keyword1=insufficient&keyword2=disk&page=1

 

=======================================================================================================

//

블로그에 글을 작성할때 반드시 밝혀야 하는 사항

google_protectAndRun("render_ads.js::google_render_ad", google_handleError, google_render_ad);


BDE를 이용한 데이터베이스 프로그래밍시 "Insufficient Disk Space" 오류가 발생하는데, 이는 디스크의 사용공간이 4GB의 배수에 근접할때 발생하는 BDE 버그라고 한다.

해결방법에 대한 링크가 엠바카데로 개발자 네트워크 홈페이지에 존재한다.

링크 : http://cc.embarcadero.com/item/21475

This unit is a patch for the famous 4Gb BDE Bug. It is build to fix the 'Insufficient disk space'-error which can occur while using BDE when the disk free space is near to a multiple of 4Gb. For more information please see BDE report# 7089 on Quality Central.
The reason for the error in BDE is aparently a bug in idapi32.dll while computing free disk space. Idapi32.dll is using the api function called GetDiskFreeSpaceA exported by kernel32.dll.

The solution is to 'patch' GetDiskFreeSpaceA in kernel32.dll for the current process, every call to this function is redirected to a new routine (NewGetDiskFreeSpaceA).

The source code of the patch is included. If you use another programming language (i.e. not Delphi), a precompiled DLL (FIX4GBug.dll) is also included. (If you can compile the included unit, then you do not need to distribute the DLL)


출처 : http://dolba.net/tt/k2club/2518
다음검색
현재 게시글 추가 기능 열기
  • 북마크
  • 신고 센터로 신고

댓글

댓글 리스트
맨위로

카페 검색

카페 검색어 입력폼