MCPcopy Create free account
hub / github.com/diasurgical/devilution / DiabloAllocPtr

Function DiabloAllocPtr

Source/engine.cpp:940–955  ·  view source on GitHub ↗

* @brief Multithreaded safe malloc * @param dwBytes Byte size to allocate */

Source from the content-addressed store, hash-verified

938 * @param dwBytes Byte size to allocate
939 */
940BYTE *DiabloAllocPtr(DWORD dwBytes)
941{
942 BYTE *buf;
943
944 sgMemCrit.Enter();
945 buf = (BYTE *)SMemAlloc(dwBytes, __FILE__, __LINE__, 0);
946 sgMemCrit.Leave();
947
948 if (buf == NULL) {
949 char *text = "System memory exhausted.\n"
950 "Make sure you have at least 64MB of free system memory before running the game";
951 ERR_DLG("Out of Memory Error", text);
952 }
953
954 return buf;
955}
956
957/**
958 * @brief Multithreaded safe memfree

Callers 15

sound_file_loadFunction · 0.85
music_startFunction · 0.85
SVidPlayBeginFunction · 0.85
msg_get_next_packetFunction · 0.85
DeltaExportDataFunction · 0.85
InitLightTableFunction · 0.85
SaveGameFunction · 0.85
SaveLevelFunction · 0.85
dthread_send_deltaFunction · 0.85
CapturePixFunction · 0.85
InitMonsterSNDFunction · 0.85
PkwareCompressFunction · 0.85

Calls 3

SMemAllocFunction · 0.85
EnterMethod · 0.80
LeaveMethod · 0.80

Tested by

no test coverage detected